You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 19:44:14 UTC
svn commit: r1181957 - /hbase/branches/0.89/bin/check_schema_consistency.rb
Author: nspiegelberg
Date: Tue Oct 11 17:44:14 2011
New Revision: 1181957
URL: http://svn.apache.org/viewvc?rev=1181957&view=rev
Log:
Table doesn't need to be online to check schema consistency.
Summary: Changed script so that it doesn't need the table to be online.
Original table descriptor is then the td of the first row in META for that
table.
Test Plan: Tested on dev cluster.
Reviewers: kannan
Reviewed By: kannan
CC: kannan
Differential Revision: 315010
Task ID: 689697
Modified:
hbase/branches/0.89/bin/check_schema_consistency.rb
Modified: hbase/branches/0.89/bin/check_schema_consistency.rb
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/bin/check_schema_consistency.rb?rev=1181957&r1=1181956&r2=1181957&view=diff
==============================================================================
--- hbase/branches/0.89/bin/check_schema_consistency.rb (original)
+++ hbase/branches/0.89/bin/check_schema_consistency.rb Tue Oct 11 17:44:14 2011
@@ -41,14 +41,12 @@ LOG = LogFactory.getLog(NAME)
c = HBaseConfiguration.new()
c.set("fs.default.name", c.get(HConstants::HBASE_DIR))
-table = HTable.new(c, Bytes.toBytes(tableName))
-td = table.getTableDescriptor()
-
LOG.info("Scanning META")
metaTable = HTable.new(c, HConstants::META_TABLE_NAME)
tableNameMetaPrefix = tableName + HConstants::META_ROW_DELIMITER.chr
scan = Scan.new(Bytes.toBytes(tableNameMetaPrefix + HConstants::META_ROW_DELIMITER.chr))
scanner = metaTable.getScanner(scan)
+first = true
while (result = scanner.next())
rowid = Bytes.toString(result.getRow())
rowidStr = java.lang.String.new(rowid)
@@ -57,6 +55,10 @@ while (result = scanner.next())
break
end
rtd = getTD(result)
+ if first
+ td = rtd
+ first = false
+ end
if !td.equals(rtd)
LOG.warn("Meta table descriptor not consistent: " + rowid)
LOG.info("Original Table desc: " + td.toString())