http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithMOB.java ---------------------------------------------------------------------- diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithMOB.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithMOB.java index 82a599c..13a5936 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithMOB.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestIngestWithMOB.java @@ -121,7 +121,7 @@ public class IntegrationTestIngestWithMOB extends IntegrationTestIngest { if(Arrays.equals(columnDescriptor.getName(), mobColumnFamily)) { columnDescriptor.setMobEnabled(true); columnDescriptor.setMobThreshold((long) threshold); - admin.modifyColumn(tableName, columnDescriptor); + admin.modifyColumnFamily(tableName, columnDescriptor); } } LOG.info("Enabling table " + getTablename());
http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index 006c3e7..71a3344 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -2682,13 +2682,15 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { /** * Returns a Admin instance. - * This instance is shared between HBaseTestingUtility instance users. - * Closing it has no effect, it will be closed automatically when the - * cluster shutdowns + * This instance is shared between HBaseTestingUtility instance users. Closing it has no effect, + * it will be closed automatically when the cluster shutdowns * - * @return An Admin instance. - * @throws IOException + * @return HBaseAdmin instance which is guaranteed to support only {@link Admin} interface. + * Functions in HBaseAdmin not provided by {@link Admin} interface can be changed/deleted + * anytime. + * @deprecated Since 2.0. Will be removed in 3.0. Use {@link #getAdmin()} instead. */ + @Deprecated public synchronized HBaseAdmin getHBaseAdmin() throws IOException { if (hbaseAdmin == null){ @@ -2697,8 +2699,18 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { return hbaseAdmin; } - private HBaseAdmin hbaseAdmin = null; + /** + * Returns an Admin instance which is shared between HBaseTestingUtility instance users. + * Closing it has no effect, it will be closed automatically when the cluster shutdowns + */ + public synchronized Admin getAdmin() throws IOException { + if (hbaseAdmin == null){ + this.hbaseAdmin = (HBaseAdmin) getConnection().getAdmin(); + } + return hbaseAdmin; + } + private HBaseAdmin hbaseAdmin = null; /** * Returns a ZooKeeperWatcher instance. http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java index 5450148..989192d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestAcidGuarantees.java @@ -88,7 +88,7 @@ public class TestAcidGuarantees implements Tool { // force mob enabled such that all data is mob data hcd.setMobEnabled(true); hcd.setMobThreshold(4); - util.getHBaseAdmin().modifyColumn(TABLE_NAME, hcd); + util.getHBaseAdmin().modifyColumnFamily(TABLE_NAME, hcd); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java index 0f286b6..e510d28 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java @@ -465,8 +465,8 @@ public class TestAdmin2 { onlineRegions.contains(info)); } - private Admin createTable(TableName tableName) throws IOException { - Admin admin = TEST_UTIL.getHBaseAdmin(); + private HBaseAdmin createTable(TableName tableName) throws IOException { + HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); HTableDescriptor htd = new HTableDescriptor(tableName); HColumnDescriptor hcd = new HColumnDescriptor("value"); http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java index 7278892..5e302d2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java @@ -400,8 +400,8 @@ public class TestMetaWithReplicas { } } assert(moveToServer != null); - String tableName = "randomTable5678"; - TEST_UTIL.createTable(TableName.valueOf(tableName), "f"); + TableName tableName = TableName.valueOf("randomTable5678"); + TEST_UTIL.createTable(tableName, "f"); assertTrue(TEST_UTIL.getHBaseAdmin().tableExists(tableName)); TEST_UTIL.getHBaseAdmin().move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(), Bytes.toBytes(moveToServer.getServerName())); @@ -413,8 +413,8 @@ public class TestMetaWithReplicas { i++; } while (!moveToServer.equals(currentServer) && i < 1000); //wait for 10 seconds overall assert(i != 1000); - TEST_UTIL.getHBaseAdmin().disableTable("randomTable5678"); - assertTrue(TEST_UTIL.getHBaseAdmin().isTableDisabled("randomTable5678")); + TEST_UTIL.getHBaseAdmin().disableTable(tableName); + assertTrue(TEST_UTIL.getHBaseAdmin().isTableDisabled(tableName)); } @Test http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestExpiredMobFileCleaner.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestExpiredMobFileCleaner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestExpiredMobFileCleaner.java index fff6f44..267201f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestExpiredMobFileCleaner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestExpiredMobFileCleaner.java @@ -100,7 +100,7 @@ public class TestExpiredMobFileCleaner { int timeToLive = expireDays * secondsOfDay(); hcd.setTimeToLive(timeToLive); - admin.modifyColumn(tableName, hcd); + admin.modifyColumnFamily(tableName, hcd); } private void putKVAndFlush(BufferedMutator table, byte[] row, byte[] value, long ts) http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestFIFOCompactionPolicy.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestFIFOCompactionPolicy.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestFIFOCompactionPolicy.java index e556a58..f3cfc39 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestFIFOCompactionPolicy.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestFIFOCompactionPolicy.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.IOException; -import java.util.Collection; import java.util.List; import java.util.Random; @@ -41,7 +40,6 @@ import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.HStore; import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.regionserver.Store; -import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.RegionServerTests; import org.apache.hadoop.hbase.util.Bytes; @@ -151,7 +149,7 @@ public class TestFIFOCompactionPolicy { TEST_UTIL.startMiniCluster(1); HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); - String tableName = this.tableName.getNameAsString()+"-TTL"; + TableName tableName = TableName.valueOf(getClass().getSimpleName() + "-TTL"); if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); @@ -180,7 +178,7 @@ public class TestFIFOCompactionPolicy { TEST_UTIL.startMiniCluster(1); HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); - String tableName = this.tableName.getNameAsString()+"-MinVersion"; + TableName tableName = TableName.valueOf(getClass().getSimpleName() + "-MinVersion"); if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); @@ -211,7 +209,7 @@ public class TestFIFOCompactionPolicy { TEST_UTIL.startMiniCluster(1); HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); - String tableName = this.tableName.getNameAsString()+"-MinVersion"; + TableName tableName = TableName.valueOf(getClass().getSimpleName() + "-BlockingStoreFiles"); if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/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 9a32b0e..c61b598 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -210,7 +210,7 @@ module Hbase def enable(table_name) tableExists(table_name) return if enabled?(table_name) - @admin.enableTable(table_name) + @admin.enableTable(TableName.valueOf(table_name)) end #---------------------------------------------------------------------------------------------- @@ -225,7 +225,7 @@ module Hbase def disable(table_name) tableExists(table_name) return if disabled?(table_name) - @admin.disableTable(table_name) + @admin.disableTable(TableName.valueOf(table_name)) end #---------------------------------------------------------------------------------------------- @@ -244,14 +244,15 @@ module Hbase #---------------------------------------------------------------------------------------------- # Is table disabled? def disabled?(table_name) - @admin.isTableDisabled(table_name) + @admin.isTableDisabled(TableName.valueOf(table_name)) end #---------------------------------------------------------------------------------------------- # Drops a table def drop(table_name) tableExists(table_name) - raise ArgumentError, "Table #{table_name} is enabled. Disable it first." if enabled?(table_name) + raise ArgumentError, "Table #{table_name} is enabled. Disable it first." if enabled?( + table_name) @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name)) end @@ -447,15 +448,17 @@ module Hbase #---------------------------------------------------------------------------------------------- # Truncates table (deletes all records by recreating the table) - def truncate(table_name, conf = @conf) - table_description = @admin.getTableDescriptor(TableName.valueOf(table_name)) - raise ArgumentError, "Table #{table_name} is not enabled. Enable it first." unless enabled?(table_name) + def truncate(table_name_str, conf = @conf) + table_name = TableName.valueOf(table_name_str) + table_description = @admin.getTableDescriptor(table_name) + raise ArgumentError, "Table #{table_name_str} is not enabled. Enable it first." unless + enabled?(table_name_str) yield 'Disabling table...' if block_given? @admin.disableTable(table_name) begin yield 'Truncating table...' if block_given? - @admin.truncateTable(org.apache.hadoop.hbase.TableName.valueOf(table_name), false) + @admin.truncateTable(table_name, false) rescue => e # Handle the compatibility case, where the truncate method doesn't exists on the Master raise e unless e.respond_to?(:cause) && e.cause != nil @@ -463,7 +466,7 @@ module Hbase if rootCause.kind_of?(org.apache.hadoop.hbase.DoNotRetryIOException) then # Handle the compatibility case, where the truncate method doesn't exists on the Master yield 'Dropping table...' if block_given? - @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name)) + @admin.deleteTable(table_name) yield 'Creating table...' if block_given? @admin.createTable(table_description) @@ -475,9 +478,10 @@ module Hbase #---------------------------------------------------------------------------------------------- # Truncates table while maintaing region boundaries (deletes all records by recreating the table) - def truncate_preserve(table_name, conf = @conf) - h_table = @connection.getTable(TableName.valueOf(table_name)) - locator = @connection.getRegionLocator(TableName.valueOf(table_name)) + def truncate_preserve(table_name_str, conf = @conf) + table_name = TableName.valueOf(table_name_str) + h_table = @connection.getTable(table_name) + locator = @connection.getRegionLocator(table_name) begin splits = locator.getAllRegionLocations(). map{|i| Bytes.toString(i.getRegionInfo().getStartKey)}. @@ -486,13 +490,13 @@ module Hbase locator.close() end - table_description = @admin.getTableDescriptor(TableName.valueOf(table_name)) + table_description = @admin.getTableDescriptor(table_name) yield 'Disabling table...' if block_given? - disable(table_name) + disable(table_name_str) begin yield 'Truncating table...' if block_given? - @admin.truncateTable(org.apache.hadoop.hbase.TableName.valueOf(table_name), true) + @admin.truncateTable(table_name, true) rescue => e # Handle the compatibility case, where the truncate method doesn't exists on the Master raise e unless e.respond_to?(:cause) && e.cause != nil @@ -500,7 +504,7 @@ module Hbase if rootCause.kind_of?(org.apache.hadoop.hbase.DoNotRetryIOException) then # Handle the compatibility case, where the truncate method doesn't exists on the Master yield 'Dropping table...' if block_given? - @admin.deleteTable(org.apache.hadoop.hbase.TableName.valueOf(table_name)) + @admin.deleteTable(table_name) yield 'Creating table with region boundaries...' if block_given? @admin.createTable(table_description, splits) @@ -534,18 +538,21 @@ module Hbase #---------------------------------------------------------------------------------------------- # Change table structure or table options - def alter(table_name, wait = true, *args) + def alter(table_name_str, wait = true, *args) # Table name should be a string - raise(ArgumentError, "Table name must be of type String") unless table_name.kind_of?(String) + raise(ArgumentError, "Table name must be of type String") unless + table_name_str.kind_of?(String) # Table should exist - raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name) + raise(ArgumentError, "Can't find a table: #{table_name_str}") unless exists?(table_name_str) # There should be at least one argument raise(ArgumentError, "There should be at least one argument but the table name") if args.empty? + table_name = TableName.valueOf(table_name_str) + # Get table descriptor - htd = @admin.getTableDescriptor(TableName.valueOf(table_name)) + htd = @admin.getTableDescriptor(table_name) # Process all args args.each do |arg| @@ -573,11 +580,11 @@ module Hbase if wait == true puts "Updating all regions with the new schema..." - alter_status(table_name) + alter_status(table_name_str) end # We bypass descriptor when adding column families; refresh it to apply other args correctly. - htd = @admin.getTableDescriptor(TableName.valueOf(table_name)) + htd = @admin.getTableDescriptor(table_name) next end @@ -587,7 +594,7 @@ module Hbase # Delete column family if method == "delete" raise(ArgumentError, "NAME parameter missing for delete method") unless name - @admin.deleteColumn(table_name, name) + @admin.deleteColumn(table_name, name.to_java_bytes) # Unset table attributes elsif method == "table_att_unset" raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name @@ -604,7 +611,7 @@ module Hbase end htd.remove(name) end - @admin.modifyTable(table_name.to_java_bytes, htd) + @admin.modifyTable(table_name, htd) # Unknown method else raise ArgumentError, "Unknown method: #{method}" @@ -616,12 +623,12 @@ module Hbase if wait == true puts "Updating all regions with the new schema..." - alter_status(table_name) + alter_status(table_name_str) end if method == "delete" # We bypass descriptor when deleting column families; refresh it to apply other args correctly. - htd = @admin.getTableDescriptor(TableName.valueOf(table_name)) + htd = @admin.getTableDescriptor(table_name) end next end @@ -667,7 +674,7 @@ module Hbase arg.delete(key) end - @admin.modifyTable(table_name.to_java_bytes, htd) + @admin.modifyTable(table_name, htd) arg.each_key do |unknown_key| puts("Unknown argument ignored: %s" % [unknown_key]) @@ -675,7 +682,7 @@ module Hbase if wait == true puts "Updating all regions with the new schema..." - alter_status(table_name) + alter_status(table_name_str) end next end @@ -792,13 +799,13 @@ module Hbase # Does table exist? def exists?(table_name) - @admin.tableExists(table_name) + @admin.tableExists(TableName.valueOf(table_name)) end #---------------------------------------------------------------------------------------------- # Is table enabled def enabled?(table_name) - @admin.isTableEnabled(table_name) + @admin.isTableEnabled(TableName.valueOf(table_name)) end #---------------------------------------------------------------------------------------------- @@ -910,14 +917,23 @@ module Hbase #---------------------------------------------------------------------------------------------- # Take a snapshot of specified table def snapshot(table, snapshot_name, *args) + # Table name should be a string + raise(ArgumentError, "Table name must be of type String") unless table.kind_of?(String) + + # Snapshot name should be a string + raise(ArgumentError, "Snapshot name must be of type String") unless + snapshot_name.kind_of?(String) + + table_name = TableName.valueOf(table) if args.empty? - @admin.snapshot(snapshot_name.to_java_bytes, table.to_java_bytes) + @admin.snapshot(snapshot_name, table_name) else args.each do |arg| if arg[SKIP_FLUSH] == true - @admin.snapshot(snapshot_name.to_java_bytes, table.to_java_bytes, SnapshotDescription::Type::SKIPFLUSH) + @admin.snapshot(snapshot_name, table_name, + SnapshotDescription::Type::SKIPFLUSH) else - @admin.snapshot(snapshot_name.to_java_bytes, table.to_java_bytes) + @admin.snapshot(snapshot_name, table_name) end end end @@ -926,19 +942,19 @@ module Hbase #---------------------------------------------------------------------------------------------- # Restore specified snapshot def restore_snapshot(snapshot_name) - @admin.restoreSnapshot(snapshot_name.to_java_bytes) + @admin.restoreSnapshot(snapshot_name) end #---------------------------------------------------------------------------------------------- # Create a new table by cloning the snapshot content def clone_snapshot(snapshot_name, table) - @admin.cloneSnapshot(snapshot_name.to_java_bytes, table.to_java_bytes) + @admin.cloneSnapshot(snapshot_name, TableName.valueOf(table)) end #---------------------------------------------------------------------------------------------- # Delete specified snapshot def delete_snapshot(snapshot_name) - @admin.deleteSnapshot(snapshot_name.to_java_bytes) + @admin.deleteSnapshot(snapshot_name) end #---------------------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-shell/src/main/ruby/hbase/security.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/hbase/security.rb b/hbase-shell/src/main/ruby/hbase/security.rb index c7b94e8..20f3298 100644 --- a/hbase-shell/src/main/ruby/hbase/security.rb +++ b/hbase-shell/src/main/ruby/hbase/security.rb @@ -64,7 +64,7 @@ module Hbase # Table should exist raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name) - tableName = org.apache.hadoop.hbase.TableName.valueOf(table_name.to_java_bytes) + tableName = org.apache.hadoop.hbase.TableName.valueOf(table_name) htd = @admin.getTableDescriptor(tableName) if (family != nil) @@ -106,7 +106,7 @@ module Hbase # Table should exist raise(ArgumentError, "Can't find a table: #{table_name}") unless exists?(table_name) - tableName = org.apache.hadoop.hbase.TableName.valueOf(table_name.to_java_bytes) + tableName = org.apache.hadoop.hbase.TableName.valueOf(table_name) htd = @admin.getTableDescriptor(tableName) if (family != nil) @@ -165,7 +165,7 @@ module Hbase # Does table exist? def exists?(table_name) - @admin.tableExists(table_name) + @admin.tableExists(TableName.valueOf(table_name)) end def isNamespace?(table_name) http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-shell/src/main/ruby/hbase/visibility_labels.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/main/ruby/hbase/visibility_labels.rb b/hbase-shell/src/main/ruby/hbase/visibility_labels.rb index 0d50d8a..98bfb2c 100644 --- a/hbase-shell/src/main/ruby/hbase/visibility_labels.rb +++ b/hbase-shell/src/main/ruby/hbase/visibility_labels.rb @@ -153,7 +153,7 @@ module Hbase # Does table exist? def exists?(table_name) - @admin.tableExists(table_name) + @admin.tableExists(TableName.valueOf(table_name)) end end end http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/hbase-shell/src/test/ruby/hbase/admin_test.rb ---------------------------------------------------------------------- diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 0a1a92e..0270037 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -405,21 +405,21 @@ module Hbase end #------------------------------------------------------------------------------- - define_test "Snapshot should fail with non-string snapshot name" do - assert_raise(NoMethodError) do + define_test "Snapshot should fail with non-string table name" do + assert_raise(ArgumentError) do admin.snapshot(123, 'xxx') end end - define_test "Snapshot should fail with non-string table name" do - assert_raise(NoMethodError) do - admin.snapshot(@create_test_snapshot, 123) + define_test "Snapshot should fail with non-string snapshot name" do + assert_raise(ArgumentError) do + admin.snapshot(@test_name, 123) end end - define_test "Snapshot should fail without table name" do + define_test "Snapshot should fail without snapshot name" do assert_raise(ArgumentError) do - admin.snapshot("hbase_create_test_snapshot") + admin.snapshot(@test_name) end end http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/src/main/asciidoc/_chapters/cp.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/cp.adoc b/src/main/asciidoc/_chapters/cp.adoc index aa2ac0f..a4587ec 100644 --- a/src/main/asciidoc/_chapters/cp.adoc +++ b/src/main/asciidoc/_chapters/cp.adoc @@ -421,7 +421,7 @@ onwards. + [source,java] ---- -String tableName = "users"; +TableName tableName = TableName.valueOf("users"); String path = "hdfs://<namenode>:<port>/user/<hadoop-user>/coprocessor.jar"; Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/src/main/asciidoc/_chapters/external_apis.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/external_apis.adoc b/src/main/asciidoc/_chapters/external_apis.adoc index 4aa5815..43a428a 100644 --- a/src/main/asciidoc/_chapters/external_apis.adoc +++ b/src/main/asciidoc/_chapters/external_apis.adoc @@ -741,7 +741,7 @@ the data, and deletes the table. [source,jython] ---- import java.lang -from org.apache.hadoop.hbase import HBaseConfiguration, HTableDescriptor, HColumnDescriptor, HConstants +from org.apache.hadoop.hbase import HBaseConfiguration, HTableDescriptor, HColumnDescriptor, HConstants, TableName from org.apache.hadoop.hbase.client import HBaseAdmin, HTable, Get from org.apache.hadoop.hbase.io import Cell, RowResult @@ -753,7 +753,7 @@ conf = HBaseConfiguration() # Create a table named 'test' that has two column families, # one named 'content, and the other 'anchor'. The colons # are required for column family names. -tablename = "test" +tablename = TableName.valueOf("test") desc = HTableDescriptor(tablename) desc.addFamily(HColumnDescriptor("content:")) http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/src/main/asciidoc/_chapters/ops_mgt.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/ops_mgt.adoc b/src/main/asciidoc/_chapters/ops_mgt.adoc index db255aa..e8d44eb 100644 --- a/src/main/asciidoc/_chapters/ops_mgt.adoc +++ b/src/main/asciidoc/_chapters/ops_mgt.adoc @@ -2214,7 +2214,7 @@ or in code it would be as follows: [source,java] ---- -void rename(Admin admin, String oldTableName, String newTableName) { +void rename(Admin admin, String oldTableName, TableName newTableName) { String snapshotName = randomName(); admin.disableTable(oldTableName); admin.snapshot(snapshotName, oldTableName); http://git-wip-us.apache.org/repos/asf/hbase/blob/bebcc09f/src/main/asciidoc/_chapters/schema_design.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/schema_design.adoc b/src/main/asciidoc/_chapters/schema_design.adoc index 926df71..e2dcbad 100644 --- a/src/main/asciidoc/_chapters/schema_design.adoc +++ b/src/main/asciidoc/_chapters/schema_design.adoc @@ -53,7 +53,7 @@ Tables must be disabled when making ColumnFamily modifications, for example: Configuration config = HBaseConfiguration.create(); Admin admin = new Admin(conf); -String table = "myTable"; +TableName table = TableName.valueOf("myTable"); admin.disableTable(table);