You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/07/09 23:39:45 UTC

svn commit: r675348 - in /hadoop/hbase/trunk: CHANGES.txt bin/HBase.rb bin/hirb.rb

Author: stack
Date: Wed Jul  9 14:39:45 2008
New Revision: 675348

URL: http://svn.apache.org/viewvc?rev=675348&view=rev
Log:
HBASE-731 delete, deletefc in HBase shell do not work correctly

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/bin/HBase.rb
    hadoop/hbase/trunk/bin/hirb.rb

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=675348&r1=675347&r2=675348&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Jul  9 14:39:45 2008
@@ -171,7 +171,11 @@
    HBASE-726   Unit tests won't run because of a typo (Sebastien Rainville via Stack)
    HBASE-727   Client caught in an infinite loop when trying to connect to cached
                server locations (Izaak Rubin via Stack)
-   
+   HBASE-732   shell formatting error with the describe command
+               (Izaak Rubin via Stack)
+   HBASE-731   delete, deletefc in HBase shell do not work correctly
+               (Izaak Rubin via Stack)
+
   IMPROVEMENTS
    HBASE-559   MR example job to count table rows
    HBASE-596   DemoClient.py (Ivan Begtin via Stack)

Modified: hadoop/hbase/trunk/bin/HBase.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/HBase.rb?rev=675348&r1=675347&r2=675348&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/HBase.rb (original)
+++ hadoop/hbase/trunk/bin/HBase.rb Wed Jul  9 14:39:45 2008
@@ -174,14 +174,9 @@
     end
 
     # Delete a cell
-    def delete(row, args)
+    def delete(row, column, timestamp = HConstants::LATEST_TIMESTAMP)
       now = Time.now 
-      bu = nil
-      if timestamp
-        bu = BatchUpdate.new(row, timestamp)
-      else
-        bu = BatchUpdate.new(row)
-      end
+      bu = BatchUpdate.new(row, timestamp)
       bu.delete(column)
       @table.commit(bu)
       @formatter.header()
@@ -195,13 +190,6 @@
       @formatter.footer(now)
     end
 
-    def deletefc(row, column_family, timestamp = HConstants::LATEST_TIMESTAMP)
-      now = Time.now 
-      @table.deleteFamily(row, column_family)
-      @formatter.header()
-      @formatter.footer(now)
-    end
-
     def getAllColumns
        htd = @table.getMetadata()
        result = []
@@ -403,6 +391,25 @@
     if formatter.rowCount() != 3
       raise IOError.new("Failed endrow test")
     end
+    # Verify that delete works
+    table.delete('x1', 'x:1');
+    table.scan(['x:1'])
+    scan1 = formatter.rowCount()
+    table.scan(['x:'])
+    scan2 = formatter.rowCount()
+    if scan1 != 0 or scan2 != 9
+      raise IOError.new("Failed delete test")
+    end
+    # Verify that deletall works
+    table.put('x2', 'x:1', 'x:1')
+    table.deleteall('x2')
+    table.scan(['x:2'])
+    scan1 = formatter.rowCount()
+    table.scan(['x:'])
+    scan2 = formatter.rowCount()
+    if scan1 != 0 or scan2 != 8
+      raise IOError.new("Failed deleteall test")
+    end
     admin.disable(TESTTABLE)
     admin.drop(TESTTABLE)
   end

Modified: hadoop/hbase/trunk/bin/hirb.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hirb.rb?rev=675348&r1=675347&r2=675348&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/hirb.rb (original)
+++ hadoop/hbase/trunk/bin/hirb.rb Wed Jul  9 14:39:45 2008
@@ -135,16 +135,14 @@
  delete    Put a delete cell value at specified table/row/column and optionally
            timestamp coordinates.  Deletes must match the deleted cell's
            coordinates exactly.  When scanning, a delete cell suppresses older
-           versions. Takes arguments like 'put' described below
+           versions. Takes arguments like the 'put' command described below
  
- deleteall Delete all cells; pass a table name, row and optionally, a column
-           and timestamp
-
- deletefc  Delete all in the named column family.  Pass table name and family
-
- drop      Drop the named table. Table must first be disabled
+ deleteall Delete all cells in a given row; pass a table name, row, and optionally 
+           a column and timestamp
 
  disable   Disable the named table: e.g. "hbase> disable 't1'"
+ 
+ drop      Drop the named table. Table must first be disabled
 
  enable    Enable the named table
 
@@ -169,14 +167,15 @@
            hbase> put 't1', 'r1', 'c1', ts1
 
  scan      Scan a table; pass table name and optionally an array of column
-           names and a dictionary of scanner specification that includes one
-           or more of following: LIMIT, FILTER, STARTROW, STOPROW, or TIMESTAMP.
-           Examples:
+           names and a dictionary of scanner specification that may include
+           one or more of following: LIMIT, STARTROW, STOPROW, or TIMESTAMP.
+           To scan all members of a column family, leave the qualifier empty
+           as in 'col_family:'.  Examples:
            
            hbase> scan '.META.'
            hbase> scan '.META.', ['info:regioninfo']
            hbase> scan 't1', ['c1', 'c2'], {LIMIT => 10, STARTROW => 'xyz'}
-
+           
  version   Output this HBase version
 
 GENERAL NOTES:
@@ -265,8 +264,9 @@
   table(table).scan(columns, args)
 end
   
-def delete(table, row, *args)
-  table(table).get(row, args)
+def delete(table, row, column,
+    timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
+  table(table).delete(row, column, timestamp)
 end
 
 def deleteall(table, row, column = nil,
@@ -274,11 +274,6 @@
   table(table).deleteall(row, column, timestamp)
 end
 
-def deletefc(table, row, column_family,
-    timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP)
-  table(table).get(row, column_family, timestamp)
-end
-
 # Output a banner message that tells users where to go for help
 puts <<HERE
 HBase Shell; enter 'help<RETURN>' for list of supported commands.