hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: HBASE-19340 Backport missing options in shell
Date Thu, 07 Dec 2017 06:13:59 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 a1e77f605 -> 45e230959


HBASE-19340 Backport missing options in shell

Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>


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

Branch: refs/heads/branch-1.2
Commit: 45e230959bf141550cadd69a4c0a078c6fd1c2ee
Parents: a1e77f6
Author: zhaoyuan <zhaoyuan@youzan.com>
Authored: Wed Dec 6 14:24:46 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Thu Dec 7 14:13:28 2017 +0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/admin.rb      | 15 ++++++++++--
 hbase-shell/src/test/ruby/hbase/admin_test.rb | 28 +++++++++++++++++++---
 2 files changed, 38 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/45e23095/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 a9e49c5..0fd1267 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -330,7 +330,7 @@ module Hbase
         htd.setOwnerString(arg.delete(OWNER)) if arg[OWNER]
         htd.setMaxFileSize(JLong.valueOf(arg.delete(MAX_FILESIZE))) if arg[MAX_FILESIZE]
         htd.setReadOnly(JBoolean.valueOf(arg.delete(READONLY))) if arg[READONLY]
-        htd.setCompactionEnabled(JBoolean.valueOf(arg[COMPACTION_ENABLED])) if arg[COMPACTION_ENABLED]
+        htd.setCompactionEnabled(JBoolean.valueOf(arg.delete[COMPACTION_ENABLED])) if arg[COMPACTION_ENABLED]
         htd.setMemStoreFlushSize(JLong.valueOf(arg.delete(MEMSTORE_FLUSHSIZE))) if arg[MEMSTORE_FLUSHSIZE]
         # DEFERRED_LOG_FLUSH is deprecated and was replaced by DURABILITY.  To keep backward
compatible, it still exists.
         # However, it has to be set before DURABILITY so that DURABILITY could overwrite
if both args are set
@@ -342,6 +342,10 @@ module Hbase
           end
         end
         htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf(arg.delete(DURABILITY)))
if arg[DURABILITY]
+        htd.setFlushPolicyClassName(arg.delete(FLUSH_POLICY)) if arg[FLUSH_POLICY]
+        htd.setRegionSplitPolicyClassName(arg.delete(SPLIT_POLICY)) if arg[SPLIT_POLICY]
+        htd.setRegionMemstoreReplication(JBoolean.valueOf(arg.delete(REGION_MEMSTORE_REPLICATION)))
if arg[REGION_MEMSTORE_REPLICATION]
+        htd.setRegionReplication(JInteger.valueOf(arg.delete(REGION_REPLICATION))) if arg[REGION_REPLICATION]
         parse_htd_args(htd, arg)
         set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA]
         set_descriptor_config(htd, arg.delete(CONFIGURATION)) if arg[CONFIGURATION]
@@ -598,7 +602,7 @@ module Hbase
         htd.setOwnerString(arg.delete(OWNER)) if arg[OWNER]
         htd.setMaxFileSize(JLong.valueOf(arg.delete(MAX_FILESIZE))) if arg[MAX_FILESIZE]
         htd.setReadOnly(JBoolean.valueOf(arg.delete(READONLY))) if arg[READONLY]
-        htd.setCompactionEnabled(JBoolean.valueOf(arg[COMPACTION_ENABLED])) if arg[COMPACTION_ENABLED]
+        htd.setCompactionEnabled(JBoolean.valueOf(arg.delete[COMPACTION_ENABLED])) if arg[COMPACTION_ENABLED]
         parse_htd_args(htd, arg)
         htd.setMemStoreFlushSize(JLong.valueOf(arg.delete(MEMSTORE_FLUSHSIZE))) if arg[MEMSTORE_FLUSHSIZE]
         # DEFERRED_LOG_FLUSH is deprecated and was replaced by DURABILITY.  To keep backward
compatible, it still exists.
@@ -611,6 +615,9 @@ module Hbase
           end
         end
         htd.setDurability(org.apache.hadoop.hbase.client.Durability.valueOf(arg.delete(DURABILITY)))
if arg[DURABILITY]
+        htd.setFlushPolicyClassName(arg.delete(FLUSH_POLICY)) if arg[FLUSH_POLICY]
+        htd.setRegionSplitPolicyClassName(arg.delete(SPLIT_POLICY)) if arg[SPLIT_POLICY]
+        htd.setRegionMemstoreReplication(JBoolean.valueOf(arg.delete(REGION_MEMSTORE_REPLICATION)))
if arg[REGION_MEMSTORE_REPLICATION]
         htd.setRegionReplication(JInteger.valueOf(arg.delete(REGION_REPLICATION))) if arg[REGION_REPLICATION]
         set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA]
         set_descriptor_config(htd, arg.delete(CONFIGURATION)) if arg[CONFIGURATION]
@@ -789,6 +796,10 @@ module Hbase
       family.setBlockCacheEnabled(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOCKCACHE)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOCKCACHE)
       family.setScope(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::REPLICATION_SCOPE)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::REPLICATION_SCOPE)
       family.setCacheDataOnWrite(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_DATA_ON_WRITE)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_DATA_ON_WRITE)
+      family.setCacheIndexesOnWrite(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_INDEX_ON_WRITE)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_INDEX_ON_WRITE)
+      family.setCacheBloomsOnWrite(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_BLOOMS_ON_WRITE)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_BLOOMS_ON_WRITE)
+      family.setEvictBlocksOnClose(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::EVICT_BLOCKS_ON_CLOSE)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::EVICT_BLOCKS_ON_CLOSE)
+      family.setCacheDataInL1(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_DATA_IN_L1)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::CACHE_DATA_IN_L1)
       family.setInMemory(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::IN_MEMORY)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::IN_MEMORY)
       family.setTimeToLive(JInteger.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::TTL)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::TTL)
       family.setDataBlockEncoding(org.apache.hadoop.hbase.io.encoding.DataBlockEncoding.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::DATA_BLOCK_ENCODING)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::DATA_BLOCK_ENCODING)

http://git-wip-us.apache.org/repos/asf/hbase/blob/45e23095/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 713706f..5dbcc89 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -185,10 +185,18 @@ module Hbase
     
     define_test "create should be able to set table options" do
       drop_test_table(@create_test_name)
-      admin.create(@create_test_name, 'a', 'b', 'MAX_FILESIZE' => 12345678, OWNER =>
'987654321')
+      admin.create(@create_test_name, 'a', 'b',
+      'MAX_FILESIZE' => 12345678,
+      OWNER => '987654321',
+      FLUSH_POLICY => 'org.apache.hadoop.hbase.regionserver.FlushAllLargeStoresPolicy',
+      SPLIT_POLICY => 'org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy',
+      REGION_MEMSTORE_REPLICATION => 'TRUE')
       assert_equal(['a:', 'b:'], table(@create_test_name).get_all_columns.sort)
       assert_match(/12345678/, admin.describe(@create_test_name))
       assert_match(/987654321/, admin.describe(@create_test_name))
+      assert_match(/org.apache.hadoop.hbase.regionserver.FlushAllLargeStoresPolicy/,admin.describe(@create_test_name))
+      assert_match(/org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy/,admin.describe(@create_test_name))
+      assert_match(/REGION_MEMSTORE_REPLICATION/, admin.describe(@create_test_name))
     end
         
     define_test "create should ignore table_att" do
@@ -308,13 +316,27 @@ module Hbase
     end
 
     define_test "alter should be able to change table options" do
-      admin.alter(@test_name, true, METHOD => 'table_att', 'MAX_FILESIZE' => 12345678)
+      admin.alter(@test_name, true, METHOD => 'table_att',
+      'MAX_FILESIZE' => 12345678,
+      'FLUSH_POLICY' => 'org.apache.hadoop.hbase.regionserver.FlushAllLargeStoresPolicy',
+      'SPLIT_POLICY' => 'org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy',
+      'REGION_MEMSTORE_REPLICATION' => 'TRUE')
       assert_match(/12345678/, admin.describe(@test_name))
+      assert_match(/org.apache.hadoop.hbase.regionserver.FlushAllLargeStoresPolicy/,admin.describe(@test_name))
+      assert_match(/org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy/,admin.describe(@test_name))
+      assert_match(/REGION_MEMSTORE_REPLICATION/, admin.describe(@test_name))
     end
 
     define_test "alter should be able to change table options w/o table_att" do
-      admin.alter(@test_name, true, 'MAX_FILESIZE' => 12345678)
+      admin.alter(@test_name, true,
+      'MAX_FILESIZE' => 12345678,
+      'FLUSH_POLICY' => 'org.apache.hadoop.hbase.regionserver.FlushAllLargeStoresPolicy',
+      'SPLIT_POLICY' => 'org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy',
+      'REGION_MEMSTORE_REPLICATION' => 'TRUE')
       assert_match(/12345678/, admin.describe(@test_name))
+      assert_match(/org.apache.hadoop.hbase.regionserver.FlushAllLargeStoresPolicy/,admin.describe(@test_name))
+      assert_match(/org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy/,admin.describe(@test_name))
+      assert_match(/REGION_MEMSTORE_REPLICATION/, admin.describe(@test_name))
     end
     
     define_test "alter should be able to change coprocessor attributes" do


Mime
View raw message