Skip to content

Instantly share code, notes, and snippets.

@ekoontz
Created September 24, 2010 22:11
Show Gist options
  • Save ekoontz/596142 to your computer and use it in GitHub Desktop.
Save ekoontz/596142 to your computer and use it in GitHub Desktop.
From be8b9006f136b73aa002e00683ca26cc355268ab Mon Sep 17 00:00:00 2001
From: Eugene Koontz <[email protected]>
Date: Fri, 24 Sep 2010 15:11:35 -0700
Subject: [PATCH] fix for #47
---
src/main/ruby/hbase/admin.rb | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/src/main/ruby/hbase/admin.rb b/src/main/ruby/hbase/admin.rb
index a4ffb76..2545214 100644
--- a/src/main/ruby/hbase/admin.rb
+++ b/src/main/ruby/hbase/admin.rb
@@ -40,6 +40,7 @@ module Hbase
zk = @zk_wrapper.getZooKeeper()
@zk_main = ZooKeeperMain.new(zk)
@formatter = formatter
+ @meta = HTable.new(HConstants::META_TABLE_NAME)
end
#----------------------------------------------------------------------------------------------
@@ -214,24 +215,16 @@ module Hbase
end
- def killme()
- 1.upto 11 do |x|
- get_first_region('foo')
- end
- end
-
def get_first_region(table_name)
#return the name of the first region for the given table name.
#for example, given "foo", this will return something like:
# "foo,,1285018739013.639eb6f8570828eb2fcab130b7914c25."
- meta = HTable.new(HConstants::META_TABLE_NAME)
region = nil
scan = Scan.new
- scan.setStartRow(Bytes.toBytes(table_name+",,"))
- scan.setCaching(1);
- scanner = meta.getScanner(scan)
+ scan.setStartRow(Bytes.toBytes('foo'+",,"))
+ scan.setCaching(0);
+ scanner = @meta.getScanner(scan)
iter = scanner.iterator
-
row = iter.next
row_string = row.to_s
kv = row.list[0]
--
1.7.1+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment