diff --git a/CHANGES.txt b/CHANGES.txt index 22b3f624461..1bd5774deca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -65,6 +65,7 @@ Hbase Change Log HBASE-613 Timestamp-anchored scanning fails to find all records HBASE-681 NPE in Memcache HBASE-701 Showing bytes in log when should be String + HBASE-702 deleteall doesn't IMPROVEMENTS diff --git a/bin/hirb.rb b/bin/hirb.rb index 93b6617d433..9864239fb41 100644 --- a/bin/hirb.rb +++ b/bin/hirb.rb @@ -263,7 +263,7 @@ end def deleteall(table, row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) - table(table).get(row, column, timestamp) + table(table).deleteall(row, column, timestamp) end def deletefc(table, row, column_family, diff --git a/src/java/org/apache/hadoop/hbase/client/HTable.java b/src/java/org/apache/hadoop/hbase/client/HTable.java index cfff31137e5..e6736b606c3 100644 --- a/src/java/org/apache/hadoop/hbase/client/HTable.java +++ b/src/java/org/apache/hadoop/hbase/client/HTable.java @@ -1088,6 +1088,30 @@ public class HTable { deleteAll(row, null, ts); } + /** + * Completely delete the row's cells. + * + * @param row Key of the row you want to completely delete. + * @param ts Delete all cells of the same timestamp or older. + * @throws IOException + */ + public void deleteAll(final String row, final long ts) + throws IOException { + deleteAll(row, null, ts); + } + + /** + * Completely delete the row's cells. + * + * @param row Key of the row you want to completely delete. + * @param ts Delete all cells of the same timestamp or older. + * @throws IOException + */ + public void deleteAll(final Text row, final long ts) + throws IOException { + deleteAll(row, null, ts); + } + /** * Delete all cells that match the passed row and column. * @param row Row to update @@ -1132,7 +1156,8 @@ public class HTable { */ public void deleteAll(final String row, final String column, final long ts) throws IOException { - deleteAll(Bytes.toBytes(row), Bytes.toBytes(column), ts); + deleteAll(Bytes.toBytes(row), + column != null? Bytes.toBytes(column): null, ts); } /** @@ -1148,8 +1173,13 @@ public class HTable { connection.getRegionServerWithRetries( new ServerCallable(connection, tableName, row) { public Boolean call() throws IOException { - server.deleteAll(location.getRegionInfo().getRegionName(), row, - column, ts); + if (column != null) { + this.server.deleteAll(location.getRegionInfo().getRegionName(), + row, column, ts); + } else { + this.server.deleteAll(location.getRegionInfo().getRegionName(), + row, ts); + } return null; } }