HBASE-1633 Can't delete in TRUNK shell; makes it hard doing admin repairs

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@792793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-07-10 03:25:20 +00:00
parent 2ec772096e
commit 732abb77c8
4 changed files with 17 additions and 14 deletions

View File

@ -250,6 +250,7 @@ Release 0.20.0 - Unreleased
HBASE-1625 Adding check to Put.add(KeyValue kv), to see that it has the same HBASE-1625 Adding check to Put.add(KeyValue kv), to see that it has the same
row as when instantiated (Erik Holstad via Stack) row as when instantiated (Erik Holstad via Stack)
HBASE-1629 HRS unable to contact master HBASE-1629 HRS unable to contact master
HBASE-1633 Can't delete in TRUNK shell; makes it hard doing admin repairs
IMPROVEMENTS IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -13,6 +13,7 @@ include_class('java.lang.Boolean') {|package,name| "J#{name}" }
import org.apache.hadoop.hbase.client.HBaseAdmin import org.apache.hadoop.hbase.client.HBaseAdmin
import org.apache.hadoop.hbase.client.HTable import org.apache.hadoop.hbase.client.HTable
import org.apache.hadoop.hbase.client.Delete
import org.apache.hadoop.hbase.HConstants import org.apache.hadoop.hbase.HConstants
import org.apache.hadoop.hbase.io.BatchUpdate import org.apache.hadoop.hbase.io.BatchUpdate
import org.apache.hadoop.hbase.io.RowResult import org.apache.hadoop.hbase.io.RowResult
@ -344,16 +345,17 @@ module HBase
# Delete a cell # Delete a cell
def delete(row, column, timestamp = HConstants::LATEST_TIMESTAMP) def delete(row, column, timestamp = HConstants::LATEST_TIMESTAMP)
now = Time.now now = Time.now
bu = BatchUpdate.new(row, timestamp) d = Delete.new(row.to_java_bytes, timestamp, nil)
bu.delete(column) d.deleteColumn(Bytes.toBytes(column))
@table.commit(bu) @table.delete(d)
@formatter.header() @formatter.header()
@formatter.footer(now) @formatter.footer(now)
end end
def deleteall(row, column = nil, timestamp = HConstants::LATEST_TIMESTAMP) def deleteall(row, column = nil, timestamp = HConstants::LATEST_TIMESTAMP)
now = Time.now now = Time.now
@table.deleteAll(row, column, timestamp) d = Delete.new(row.to_java_bytes, timestamp, nil)
@table.delete(d)
@formatter.header() @formatter.header()
@formatter.footer(now) @formatter.footer(now)
end end

View File

@ -348,20 +348,21 @@ public class HConnectionManager implements HConstants {
getMaster(); getMaster();
final TreeSet<HTableDescriptor> uniqueTables = final TreeSet<HTableDescriptor> uniqueTables =
new TreeSet<HTableDescriptor>(); new TreeSet<HTableDescriptor>();
MetaScannerVisitor visitor = new MetaScannerVisitor() { MetaScannerVisitor visitor = new MetaScannerVisitor() {
public boolean processRow(Result result) throws IOException { public boolean processRow(Result result) throws IOException {
HRegionInfo info = Writables.getHRegionInfo( try {
HRegionInfo info = Writables.getHRegionInfo(
result.getValue(CATALOG_FAMILY, REGIONINFO_QUALIFIER)); result.getValue(CATALOG_FAMILY, REGIONINFO_QUALIFIER));
// Only examine the rows where the startKey is zero length
// Only examine the rows where the startKey is zero length if (info != null && info.getStartKey().length == 0) {
if (info != null && info.getStartKey().length == 0) { uniqueTables.add(info.getTableDesc());
uniqueTables.add(info.getTableDesc()); }
return true;
} catch (RuntimeException e) {
LOG.error("Result=" + result);
throw e;
} }
return true;
} }
}; };
MetaScanner.metaScan(conf, visitor); MetaScanner.metaScan(conf, visitor);

View File

@ -427,7 +427,6 @@ public class HTable {
connection.getRegionServerWithRetries( connection.getRegionServerWithRetries(
new ServerCallable<Boolean>(connection, tableName, delete.getRow()) { new ServerCallable<Boolean>(connection, tableName, delete.getRow()) {
public Boolean call() throws IOException { public Boolean call() throws IOException {
System.out.println("IN HT.get.ServerCallable,");
server.delete(location.getRegionInfo().getRegionName(), delete); server.delete(location.getRegionInfo().getRegionName(), delete);
return null; return null;
} }