hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: HBASE-13111 truncate_preserve command is failing with undefined method error (Ashish Singhi)
Date Mon, 02 Mar 2015 23:20:22 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 0bbf4b357 -> 53eaa6e9d


HBASE-13111 truncate_preserve command is failing with undefined method error (Ashish Singhi)

Conflicts:
	hbase-shell/src/main/ruby/hbase/admin.rb

Amending-Author: Andrew Purtell <apurtell@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/53eaa6e9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/53eaa6e9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/53eaa6e9

Branch: refs/heads/0.98
Commit: 53eaa6e9dee149556497f1df13d48fbe502e39bf
Parents: 0bbf4b3
Author: tedyu <yuzhihong@gmail.com>
Authored: Mon Mar 2 15:18:17 2015 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon Mar 2 15:18:17 2015 -0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/admin.rb | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/53eaa6e9/hbase-shell/src/main/ruby/hbase/admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb
index dad66c6..37dab52 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -19,6 +19,7 @@
 
 include Java
 java_import java.util.Arrays
+java_import org.apache.hadoop.hbase.TableName
 java_import org.apache.hadoop.hbase.util.Pair
 java_import org.apache.hadoop.hbase.util.RegionSplitter
 java_import org.apache.hadoop.hbase.util.Bytes
@@ -32,7 +33,7 @@ module Hbase
 
     def initialize(configuration, formatter)
       @admin = org.apache.hadoop.hbase.client.HBaseAdmin.new(configuration)
-      connection = @admin.getConnection()
+      @connection = org.apache.hadoop.hbase.client.HConnectionManager.createConnection(configuration)
       @conf = configuration
       @formatter = formatter
     end
@@ -352,7 +353,7 @@ module Hbase
     #----------------------------------------------------------------------------------------------
     # Truncates table (deletes all records by recreating the table)
     def truncate(table_name, conf = @conf)
-      h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name)
+      h_table = @connection.getTable(TableName.valueOf(table_name))
       table_description = h_table.getTableDescriptor()
       raise ArgumentError, "Table #{table_name} is not enabled. Enable it first." unless
enabled?(table_name)
       yield 'Disabling table...' if block_given?
@@ -381,7 +382,7 @@ module Hbase
     #----------------------------------------------------------------------------------------------
     # Truncates table while maintaing region boundaries (deletes all records by recreating
the table)
     def truncate_preserve(table_name, conf = @conf)
-      h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name)
+      h_table = @connection.getTable(TableName.valueOf(table_name))
       splits = h_table.getRegionLocations().keys().map{|i| Bytes.toStringBinary(i.getStartKey)}.delete_if{|k|
k == ""}.to_java :String
       splits = org.apache.hadoop.hbase.util.Bytes.toBinaryByteArrays(splits)
       table_description = h_table.getTableDescriptor()
@@ -761,8 +762,7 @@ module Hbase
     # Enables/disables a region by name
     def online(region_name, on_off)
       # Open meta table
-      meta = org.apache.hadoop.hbase.client.HTable.new(
-          org.apache.hadoop.hbase.TableName::META_TABLE_NAME)
+      meta = @connection.getTable(org.apache.hadoop.hbase.TableName::META_TABLE_NAME)
 
       # Read region info
       # FIXME: fail gracefully if can't find the region


Mime
View raw message