HBASE-12595 Use Connection.getTable() in table.rb (Solomon Duskis)

This commit is contained in:
stack 2014-11-29 12:52:44 -08:00
parent 84d9f0ec26
commit c750ada8d6
1 changed files with 6 additions and 18 deletions

View File

@ -112,26 +112,14 @@ EOF
attr_reader :name attr_reader :name
def initialize(configuration, table_name, shell) def initialize(configuration, table_name, shell)
# Commenting out the HTable.new() calls and uncommenting the @connection approach causes
# Zookeepr exceptions. Interestingly, there were changes in admin.rb to convert
# HBaseAdmin.new() calls to ConnectionFactory.createConnection().getAdmin(). Either change
# of ConnectionFactory.createConnection().getTable() or
# ConnectionFactory.createConnection().getAdmin() by itself doesn't cause the Zookeper
# exception. Somehow the combination of the two causes the issue.
# TODO: Uncomment the createConnection approach after the underlying problem is fixed.
if @@thread_pool then if @@thread_pool then
@table = org.apache.hadoop.hbase.client.HTable.new(configuration, table_name.to_java_bytes, @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(
@@thread_pool) configuration, @@thread_pool)
# @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection( @table = @connection.getTable(table_name)
# configuration, @@thread_pool)
# @table = @connection.getTable(table_name)
else else
# @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection( @connection = org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(
# configuration) configuration)
# @table = @connection.getTable(table_name) @table = @connection.getTable(table_name)
@table = org.apache.hadoop.hbase.client.HTable.new(configuration, table_name)
@@thread_pool = @table.getPool() @@thread_pool = @table.getPool()
end end