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 2010/04/17 04:47:30 UTC
svn commit: r935112 - in /hadoop/hbase/branches/0.20_pre_durability:
CHANGES.txt bin/add_table.rb
Author: stack
Date: Sat Apr 17 02:47:30 2010
New Revision: 935112
URL: http://svn.apache.org/viewvc?rev=935112&view=rev
Log:
HBASE-2460 add_table.rb deletes any tables for which the target table name is a prefix
Modified:
hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
hadoop/hbase/branches/0.20_pre_durability/bin/add_table.rb
Modified: hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt?rev=935112&r1=935111&r2=935112&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt Sat Apr 17 02:47:30 2010
@@ -51,6 +51,8 @@ Release 0.20.4 - Thu Apr 15 16:29:44 PDT
(Jonathan Gray via Stack)
HBASE-2456 deleteChangedReaderObserver spitting warnings after HBASE-2248
HBASE-2456 Client stuck in TreeMap,remove (Todd Lipcon via Stack)
+ HBASE-2460 add_table.rb deletes any tables for which the target table
+ name is a prefix (Todd Lipcon via Stack)
IMPROVEMENTS
HBASE-2180 Bad read performance from synchronizing hfile.fddatainputstream
Modified: hadoop/hbase/branches/0.20_pre_durability/bin/add_table.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/bin/add_table.rb?rev=935112&r1=935111&r2=935112&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/bin/add_table.rb (original)
+++ hadoop/hbase/branches/0.20_pre_durability/bin/add_table.rb Sat Apr 17 02:47:30 2010
@@ -50,11 +50,15 @@ end
# Get cmdline args.
srcdir = fs.makeQualified(Path.new(java.lang.String.new(ARGV[0])))
+if not fs.exists(srcdir)
+ raise IOError.new("src dir " + srcdir.toString() + " doesn't exist!")
+end
+
# Get table name
tableName = nil
if ARGV.size > 1
tableName = ARGV[1]
- raise IOError("Not supported yet")
+ raise IOError.new("Not supported yet")
elsif
# If none provided use dirname
tableName = srcdir.getName()
@@ -82,14 +86,15 @@ end
# Scan the .META. and remove all lines that begin with tablename
LOG.info("Deleting mention of " + tableName + " from .META.")
metaTable = HTable.new(c, HConstants::META_TABLE_NAME)
-scan = Scan.new(tableName.to_java_bytes)
+tableNameMetaPrefix = tableName + HConstants::META_ROW_DELIMITER.chr
+scan = Scan.new((tableNameMetaPrefix + HConstants::META_ROW_DELIMITER.chr).to_java_bytes)
scanner = metaTable.getScanner(scan)
# Use java.lang.String doing compares. Ruby String is a bit odd.
tableNameStr = java.lang.String.new(tableName)
while (result = scanner.next())
rowid = Bytes.toString(result.getRow())
rowidStr = java.lang.String.new(rowid)
- if not rowidStr.startsWith(tableNameStr)
+ if not rowidStr.startsWith(tableNameMetaPrefix)
# Gone too far, break
break
end