You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2015/04/25 03:22:27 UTC

[1/5] hbase git commit: HBASE-13550 [Shell] Support unset of a list of table attributes

Repository: hbase
Updated Branches:
  refs/heads/0.98 5688ab4fa -> 7c7c4c88f
  refs/heads/branch-1 85d090d81 -> 0d6d87d0f
  refs/heads/branch-1.0 0abe8f59e -> 521cff95c
  refs/heads/branch-1.1 0fdd93f32 -> d4c630968
  refs/heads/master 8a18cf3c0 -> cd83d39fb


HBASE-13550 [Shell] Support unset of a list of table attributes


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

Branch: refs/heads/master
Commit: cd83d39fb4f50db901b699ba5470b5f709c95c69
Parents: 8a18cf3
Author: Andrew Purtell <ap...@apache.org>
Authored: Thu Apr 23 17:12:58 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Apr 24 17:51:19 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/cd83d39f/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 5219b99..e10e2be 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -518,10 +518,19 @@ module Hbase
           # Unset table attributes
           elsif method == "table_att_unset"
             raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name
-            if (htd.getValue(name) == nil)
-              raise ArgumentError, "Can not find attribute: #{name}"
+            if name.kind_of?(Array)
+              name.each do |key|
+                if (htd.getValue(key) == nil)
+                  raise ArgumentError, "Could not find attribute: #{key}"
+                end
+                htd.remove(key)
+              end
+            else
+              if (htd.getValue(name) == nil)
+                raise ArgumentError, "Could not find attribute: #{name}"
+              end
+              htd.remove(name)
             end
-            htd.remove(name)
             @admin.modifyTable(table_name.to_java_bytes, htd)
           # Unknown method
           else

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd83d39f/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 1925864..b643890 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -348,6 +348,22 @@ module Hbase
       assert_no_match(eval("/" + key + "/"), admin.describe(@test_name))
     end
 
+    define_test "alter should be able to remove a list of table attributes" do
+      drop_test_table(@test_name)
+
+      key_1 = "TestAttr1"
+      key_2 = "TestAttr2"
+      admin.create(@test_name, { NAME => 'i'}, METADATA => { key_1 => 1, key_2 => 2 })
+
+      # eval() is used to convert a string to regex
+      assert_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+
+      admin.alter(@test_name, true, 'METHOD' => 'table_att_unset', 'NAME' => [ key_1, key_2 ])
+      assert_no_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+    end
+
     define_test "get_table should get a real table" do
       drop_test_table(@test_name)
       create_test_table(@test_name)


[2/5] hbase git commit: HBASE-13550 [Shell] Support unset of a list of table attributes

Posted by ap...@apache.org.
HBASE-13550 [Shell] Support unset of a list of table attributes


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

Branch: refs/heads/branch-1.1
Commit: d4c630968ec018a9caa9280d1c130ad5da7f44a4
Parents: 0fdd93f
Author: Andrew Purtell <ap...@apache.org>
Authored: Thu Apr 23 17:12:58 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Apr 24 17:51:30 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/d4c63096/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 5219b99..e10e2be 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -518,10 +518,19 @@ module Hbase
           # Unset table attributes
           elsif method == "table_att_unset"
             raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name
-            if (htd.getValue(name) == nil)
-              raise ArgumentError, "Can not find attribute: #{name}"
+            if name.kind_of?(Array)
+              name.each do |key|
+                if (htd.getValue(key) == nil)
+                  raise ArgumentError, "Could not find attribute: #{key}"
+                end
+                htd.remove(key)
+              end
+            else
+              if (htd.getValue(name) == nil)
+                raise ArgumentError, "Could not find attribute: #{name}"
+              end
+              htd.remove(name)
             end
-            htd.remove(name)
             @admin.modifyTable(table_name.to_java_bytes, htd)
           # Unknown method
           else

http://git-wip-us.apache.org/repos/asf/hbase/blob/d4c63096/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 1925864..b643890 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -348,6 +348,22 @@ module Hbase
       assert_no_match(eval("/" + key + "/"), admin.describe(@test_name))
     end
 
+    define_test "alter should be able to remove a list of table attributes" do
+      drop_test_table(@test_name)
+
+      key_1 = "TestAttr1"
+      key_2 = "TestAttr2"
+      admin.create(@test_name, { NAME => 'i'}, METADATA => { key_1 => 1, key_2 => 2 })
+
+      # eval() is used to convert a string to regex
+      assert_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+
+      admin.alter(@test_name, true, 'METHOD' => 'table_att_unset', 'NAME' => [ key_1, key_2 ])
+      assert_no_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+    end
+
     define_test "get_table should get a real table" do
       drop_test_table(@test_name)
       create_test_table(@test_name)


[3/5] hbase git commit: HBASE-13550 [Shell] Support unset of a list of table attributes

Posted by ap...@apache.org.
HBASE-13550 [Shell] Support unset of a list of table attributes


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

Branch: refs/heads/branch-1
Commit: 0d6d87d0f83ec0b9bab0287612bad681ec5c0faf
Parents: 85d090d
Author: Andrew Purtell <ap...@apache.org>
Authored: Thu Apr 23 17:12:58 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Apr 24 17:51:33 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/0d6d87d0/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 5219b99..e10e2be 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -518,10 +518,19 @@ module Hbase
           # Unset table attributes
           elsif method == "table_att_unset"
             raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name
-            if (htd.getValue(name) == nil)
-              raise ArgumentError, "Can not find attribute: #{name}"
+            if name.kind_of?(Array)
+              name.each do |key|
+                if (htd.getValue(key) == nil)
+                  raise ArgumentError, "Could not find attribute: #{key}"
+                end
+                htd.remove(key)
+              end
+            else
+              if (htd.getValue(name) == nil)
+                raise ArgumentError, "Could not find attribute: #{name}"
+              end
+              htd.remove(name)
             end
-            htd.remove(name)
             @admin.modifyTable(table_name.to_java_bytes, htd)
           # Unknown method
           else

http://git-wip-us.apache.org/repos/asf/hbase/blob/0d6d87d0/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 1925864..b643890 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -348,6 +348,22 @@ module Hbase
       assert_no_match(eval("/" + key + "/"), admin.describe(@test_name))
     end
 
+    define_test "alter should be able to remove a list of table attributes" do
+      drop_test_table(@test_name)
+
+      key_1 = "TestAttr1"
+      key_2 = "TestAttr2"
+      admin.create(@test_name, { NAME => 'i'}, METADATA => { key_1 => 1, key_2 => 2 })
+
+      # eval() is used to convert a string to regex
+      assert_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+
+      admin.alter(@test_name, true, 'METHOD' => 'table_att_unset', 'NAME' => [ key_1, key_2 ])
+      assert_no_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+    end
+
     define_test "get_table should get a real table" do
       drop_test_table(@test_name)
       create_test_table(@test_name)


[5/5] hbase git commit: HBASE-13550 [Shell] Support unset of a list of table attributes

Posted by ap...@apache.org.
HBASE-13550 [Shell] Support unset of a list of table attributes


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

Branch: refs/heads/0.98
Commit: 7c7c4c88f97227c8600d3868de5e231eb2639707
Parents: 5688ab4
Author: Andrew Purtell <ap...@apache.org>
Authored: Thu Apr 23 17:12:58 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Apr 24 17:51:42 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/7c7c4c88/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 37dab52..e0ba840 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -490,10 +490,19 @@ module Hbase
           # Unset table attributes
           elsif method == "table_att_unset"
             raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name
-            if (htd.getValue(name) == nil)
-              raise ArgumentError, "Can not find attribute: #{name}"
+            if name.kind_of?(Array)
+              name.each do |key|
+                if (htd.getValue(key) == nil)
+                  raise ArgumentError, "Could not find attribute: #{key}"
+                end
+                htd.remove(key)
+              end
+            else
+              if (htd.getValue(name) == nil)
+                raise ArgumentError, "Could not find attribute: #{name}"
+              end
+              htd.remove(name)
             end
-            htd.remove(name)
             @admin.modifyTable(table_name.to_java_bytes, htd)
           # Unknown method
           else

http://git-wip-us.apache.org/repos/asf/hbase/blob/7c7c4c88/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 50c7235..dc0254d 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -336,6 +336,22 @@ module Hbase
       assert_no_match(eval("/" + key + "/"), admin.describe(@test_name))
     end
 
+    define_test "alter should be able to remove a list of table attributes" do
+      drop_test_table(@test_name)
+
+      key_1 = "TestAttr1"
+      key_2 = "TestAttr2"
+      admin.create(@test_name, { NAME => 'i'}, METADATA => { key_1 => 1, key_2 => 2 })
+
+      # eval() is used to convert a string to regex
+      assert_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+
+      admin.alter(@test_name, true, 'METHOD' => 'table_att_unset', 'NAME' => [ key_1, key_2 ])
+      assert_no_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+    end
+
     define_test "get_table should get a real table" do
       drop_test_table(@test_name)
       create_test_table(@test_name)


[4/5] hbase git commit: HBASE-13550 [Shell] Support unset of a list of table attributes

Posted by ap...@apache.org.
HBASE-13550 [Shell] Support unset of a list of table attributes


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

Branch: refs/heads/branch-1.0
Commit: 521cff95cb1429a6808dd20d5059d23e563d6043
Parents: 0abe8f5
Author: Andrew Purtell <ap...@apache.org>
Authored: Thu Apr 23 17:12:58 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Apr 24 17:51:38 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/521cff95/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 12571d9..f1b2980 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -511,10 +511,19 @@ module Hbase
           # Unset table attributes
           elsif method == "table_att_unset"
             raise(ArgumentError, "NAME parameter missing for table_att_unset method") unless name
-            if (htd.getValue(name) == nil)
-              raise ArgumentError, "Can not find attribute: #{name}"
+            if name.kind_of?(Array)
+              name.each do |key|
+                if (htd.getValue(key) == nil)
+                  raise ArgumentError, "Could not find attribute: #{key}"
+                end
+                htd.remove(key)
+              end
+            else
+              if (htd.getValue(name) == nil)
+                raise ArgumentError, "Could not find attribute: #{name}"
+              end
+              htd.remove(name)
             end
-            htd.remove(name)
             @admin.modifyTable(table_name.to_java_bytes, htd)
           # Unknown method
           else

http://git-wip-us.apache.org/repos/asf/hbase/blob/521cff95/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 1925864..b643890 100644
--- a/hbase-shell/src/test/ruby/hbase/admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb
@@ -348,6 +348,22 @@ module Hbase
       assert_no_match(eval("/" + key + "/"), admin.describe(@test_name))
     end
 
+    define_test "alter should be able to remove a list of table attributes" do
+      drop_test_table(@test_name)
+
+      key_1 = "TestAttr1"
+      key_2 = "TestAttr2"
+      admin.create(@test_name, { NAME => 'i'}, METADATA => { key_1 => 1, key_2 => 2 })
+
+      # eval() is used to convert a string to regex
+      assert_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+
+      admin.alter(@test_name, true, 'METHOD' => 'table_att_unset', 'NAME' => [ key_1, key_2 ])
+      assert_no_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
+      assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
+    end
+
     define_test "get_table should get a real table" do
       drop_test_table(@test_name)
       create_test_table(@test_name)