You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2016/01/04 17:57:03 UTC

[18/29] hbase git commit: HBASE-15043 region_status.rb broken with TypeError: no public constructors for Java::OrgApacheHadoopHbaseClient::HBaseAdmin (Samir Ahmic)

HBASE-15043 region_status.rb broken with TypeError: no public constructors for Java::OrgApacheHadoopHbaseClient::HBaseAdmin (Samir Ahmic)


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

Branch: refs/heads/hbase-12439
Commit: 9b8895ba295ee66fefda115f30ab727590e487e8
Parents: 1e4992c
Author: tedyu <yu...@gmail.com>
Authored: Tue Dec 29 07:06:43 2015 -0800
Committer: tedyu <yu...@gmail.com>
Committed: Tue Dec 29 07:06:43 2015 -0800

----------------------------------------------------------------------
 bin/draining_servers.rb             |  5 ++++-
 bin/region_status.rb                |  7 ++++---
 bin/replication/copy_tables_desc.rb | 12 +++++++++---
 bin/shutdown_regionserver.rb        |  6 +++++-
 4 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9b8895ba/bin/draining_servers.rb
----------------------------------------------------------------------
diff --git a/bin/draining_servers.rb b/bin/draining_servers.rb
index 45c9694..6849605 100644
--- a/bin/draining_servers.rb
+++ b/bin/draining_servers.rb
@@ -22,6 +22,7 @@ require 'optparse'
 include Java
 
 import org.apache.hadoop.hbase.HBaseConfiguration
+import org.apache.hadoop.hbase.client.ConnectionFactory
 import org.apache.hadoop.hbase.client.HBaseAdmin
 import org.apache.hadoop.hbase.zookeeper.ZKUtil
 import org.apache.commons.logging.Log
@@ -60,6 +61,7 @@ end
 
 def getServerNames(hostOrServers, config)
   ret = []
+  connection = ConnectionFactory.createConnection(config)
   
   for hostOrServer in hostOrServers
     # check whether it is already serverName. No need to connect to cluster
@@ -67,7 +69,7 @@ def getServerNames(hostOrServers, config)
     if parts.size() == 3
       ret << hostOrServer
     else 
-      admin = HBaseAdmin.new(config) if not admin
+      admin = connection.getAdmin() if not admin
       servers = getServers(admin)
 
       hostOrServer = hostOrServer.gsub(/:/, ",")
@@ -78,6 +80,7 @@ def getServerNames(hostOrServers, config)
   end
   
   admin.close() if admin
+  connection.close()
   return ret
 end
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/9b8895ba/bin/region_status.rb
----------------------------------------------------------------------
diff --git a/bin/region_status.rb b/bin/region_status.rb
index a0f9d1b..55bc672 100644
--- a/bin/region_status.rb
+++ b/bin/region_status.rb
@@ -67,12 +67,11 @@ org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(log_level)
 config = HBaseConfiguration.create
 config.set 'fs.defaultFS', config.get(HConstants::HBASE_DIR)
 connection = ConnectionFactory.createConnection(config)
-
 # wait until the master is running
 admin = nil
 while true
   begin
-    admin = HBaseAdmin.new config
+    admin = connection.getAdmin()
     break
   rescue MasterNotRunningException => e
     print 'Waiting for master to start...\n'
@@ -119,7 +118,7 @@ while iter.hasNext
     # Gone too far, break
     break
   end
-  region = HRegionInfo.getHRegionInfo result
+  region = MetaTableAccessor::getHRegionInfo(result)
   if not region.isOffline
     # only include regions that should be online
     meta_count += 1
@@ -151,5 +150,7 @@ while true
     break
   end
 end
+admin.close()
+connection.close()
 
 exit server_count == meta_count ? 0 : 1

http://git-wip-us.apache.org/repos/asf/hbase/blob/9b8895ba/bin/replication/copy_tables_desc.rb
----------------------------------------------------------------------
diff --git a/bin/replication/copy_tables_desc.rb b/bin/replication/copy_tables_desc.rb
index bc70031..8a6c670 100644
--- a/bin/replication/copy_tables_desc.rb
+++ b/bin/replication/copy_tables_desc.rb
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.EmptyWatcher
 import org.apache.hadoop.hbase.client.HBaseAdmin
 import org.apache.hadoop.hbase.HTableDescriptor
 import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.hbase.client.ConnectionFactory
 
 # Name of this script
 NAME = "copy_tables_desc"
@@ -56,18 +57,23 @@ c1.set(HConstants::ZOOKEEPER_QUORUM, parts1[0])
 c1.set("hbase.zookeeper.property.clientPort", parts1[1])
 c1.set(HConstants::ZOOKEEPER_ZNODE_PARENT, parts1[2])
 
-admin1 = HBaseAdmin.new(c1)
+connection1 = ConnectionFactory.createConnection(c1)
+admin1 = connection1.getAdmin()
 
 c2 = HBaseConfiguration.create()
 c2.set(HConstants::ZOOKEEPER_QUORUM, parts2[0])
 c2.set("hbase.zookeeper.property.clientPort", parts2[1])
 c2.set(HConstants::ZOOKEEPER_ZNODE_PARENT, parts2[2])
 
-admin2 = HBaseAdmin.new(c2)
+connection2 = ConnectionFactory.createConnection(c2)
+admin2 = connection2.getAdmin()
 
 for t in admin1.listTables()
   admin2.createTable(t)
 end
 
-
 puts "All descriptions were copied"
+admin1.close()
+admin2.close()
+connection1.close()
+connection2.close()

http://git-wip-us.apache.org/repos/asf/hbase/blob/9b8895ba/bin/shutdown_regionserver.rb
----------------------------------------------------------------------
diff --git a/bin/shutdown_regionserver.rb b/bin/shutdown_regionserver.rb
index 9287e5b..608248f 100644
--- a/bin/shutdown_regionserver.rb
+++ b/bin/shutdown_regionserver.rb
@@ -25,6 +25,7 @@
 include Java
 import org.apache.hadoop.hbase.HBaseConfiguration
 import org.apache.hadoop.hbase.client.HBaseAdmin
+import org.apache.hadoop.hbase.client.ConnectionFactory
 
 def usage(msg=nil)
   $stderr.puts 'Usage: shutdown_regionserver.rb <host:port>..'
@@ -41,8 +42,9 @@ ARGV.each do |x|
 end
 
 config = HBaseConfiguration.create()
+connection = ConnectionFactory.createConnection(config)
 begin
-  admin = HBaseAdmin.new(config)
+  admin = connection.getAdmin()
 rescue
   abort "Error: Couldn't instantiate HBaseAdmin"
 end
@@ -50,3 +52,5 @@ end
 ARGV.each do |hostport|
   admin.stopRegionServer(hostport)
 end
+admin.close()
+connection.close()