Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 20772f139 -> 3845c089d


HBASE-20575 Fail to config COMPACTION_ENABLED by hbase shell

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


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

Branch: refs/heads/branch-1.2
Commit: 3845c089dfdc4e2f7d880d87ee555fd49318020b
Parents: 20772f1
Author: Mingdao Yang <mingd...@gmail.com>
Authored: Fri Jun 29 14:52:26 2018 +0000
Committer: Chia-Ping Tsai <chia7...@gmail.com>
Committed: Sat Jun 30 00:25:37 2018 +0800

----------------------------------------------------------------------
 hbase-shell/src/main/ruby/hbase/admin.rb      |  4 ++--
 hbase-shell/src/test/ruby/hbase/admin_test.rb | 22 +++++++++++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3845c089/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 0fd1267..3f31eeb 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.delete[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
@@ -602,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.delete[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.

http://git-wip-us.apache.org/repos/asf/hbase/blob/3845c089/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 5dbcc89..e168e83 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -198,7 +198,27 @@ module Hbase
       
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 be able to set compaction in table options' do
+      drop_test_table(@create_test_name)
+      admin.create(@create_test_name, 'a', 'b',
+                   'MAX_FILESIZE' => 12_345_678,
+                   OWNER => '987654321',
+                   FLUSH_POLICY => 'org.apache.hadoop.hbase.regionserver' \
+                                   '.FlushAllLargeStoresPolicy',
+                   SPLIT_POLICY => 'org.apache.hadoop.hbase.regionserver' \
+                                   '.IncreasingToUpperBoundRegionSplitPolicy',
+                   COMPACTION_ENABLED => '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(/COMPACTION_ENABLED/, admin.describe(@create_test_name))
+    end
+
     define_test "create should ignore table_att" do
       drop_test_table(@create_test_name)
       admin.create(@create_test_name, 'a', 'b', METHOD => 'table_att', OWNER 
=> '987654321')

Reply via email to