hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [32/50] hbase git commit: HBASE-16576 Shell add_peer doesn't allow setting cluster_key for custom endpoints
Date Tue, 01 Nov 2016 19:48:10 GMT
HBASE-16576 Shell add_peer doesn't allow setting cluster_key for custom endpoints

Signed-off-by: Andrew Purtell <apurtell@apache.org>


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

Branch: refs/heads/0.98
Commit: 78b036304356b2e4da6c57bad01fc1ce228e4041
Parents: 9317955
Author: Geoffrey <gjacoby@salesforce.com>
Authored: Fri Sep 9 11:01:35 2016 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri Sep 9 14:54:14 2016 -0700

----------------------------------------------------------------------
 .../src/main/ruby/hbase/replication_admin.rb    |  2 --
 .../src/main/ruby/shell/commands/add_peer.rb    |  5 ++++-
 .../test/ruby/hbase/replication_admin_test.rb   | 20 +++++++++-----------
 3 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/78b03630/hbase-shell/src/main/ruby/hbase/replication_admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/replication_admin.rb b/hbase-shell/src/main/ruby/hbase/replication_admin.rb
index ea82384..5e5fa21 100644
--- a/hbase-shell/src/main/ruby/hbase/replication_admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/replication_admin.rb
@@ -56,8 +56,6 @@ module Hbase
         # or neither are provided
         if endpoint_classname.nil? and cluster_key.nil?
           raise(ArgumentError, "Either ENDPOINT_CLASSNAME or CLUSTER_KEY must be specified.")
-        elsif !endpoint_classname.nil? and !cluster_key.nil?
-          raise(ArgumentError, "ENDPOINT_CLASSNAME and CLUSTER_KEY cannot both be specified.")
         end
 
         # Cluster Key is required for ReplicationPeerConfig for a custom replication endpoint

http://git-wip-us.apache.org/repos/asf/hbase/blob/78b03630/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/add_peer.rb b/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
index 0fcdd3d..c42c790 100644
--- a/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/add_peer.rb
@@ -52,8 +52,11 @@ the key TABLE_CFS.
   hbase> add_peer '11', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
     DATA => { "key1" => 1 }, CONFIG => { "config1" => "value1", "config2" =>
"value2" },
     TABLE_CFS => { "table1" => [], "table2" => ["cf1"], "table3" => ["cf1", "cf2"]
}
+  hbase> add_peer '12', ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint',
+        CLUSTER_KEY => "server2.cie.com:2181:/hbase"
 
-Note: Either CLUSTER_KEY or ENDPOINT_CLASSNAME must be specified but not both.
+Note: Either CLUSTER_KEY or ENDPOINT_CLASSNAME must be specified. If ENDPOINT_CLASSNAME is
specified, CLUSTER_KEY is
+optional and should only be specified if a particular custom endpoint requires it.
 EOF
       end
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/78b03630/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb b/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
index 660ac91..a050a0e 100644
--- a/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
+++ b/hbase-shell/src/test/ruby/hbase/replication_admin_test.rb
@@ -54,14 +54,6 @@ module Hbase
       end
     end
 
-    define_test "add_peer: fail when both CLUSTER_KEY and ENDPOINT_CLASSNAME are specified"
do
-      assert_raise(ArgumentError) do
-        args = { CLUSTER_KEY => 'zk1,zk2,zk3:2182:/hbase-prod',
-                 ENDPOINT_CLASSNAME => 'org.apache.hadoop.hbase.MyReplicationEndpoint'
}
-        replication_admin.add_peer(@peer_id, args)
-      end
-    end
-
     define_test "add_peer: args must be a string or number" do
       assert_raise(ArgumentError) do
         replication_admin.add_peer(@peer_id, 1)
@@ -151,7 +143,10 @@ module Hbase
       assert_equal(1, replication_admin.list_peers.length)
       assert(replication_admin.list_peers.key?(@peer_id))
       assert_equal(cluster_key, replication_admin.list_peers.fetch(@peer_id))
-      assert_equal(table_cfs_str, replication_admin.show_peer_tableCFs(@peer_id))
+      # Note: below assertion is dependent on the sort order of an unordered
+      # map and hence flaky depending on JVM
+      # Commenting out until HBASE-16274 is worked.
+      #assert_equal(table_cfs_str, replication_admin.show_peer_tableCFs(@peer_id))
 
       # cleanup for future tests
       replication_admin.remove_peer(@peer_id)
@@ -178,11 +173,14 @@ module Hbase
     end
 
     define_test "get_peer_config: works with replicationendpointimpl peer and config params"
do
-      repl_impl = "org.apache.hadoop.hbase.replication.ReplicationEndpointForTest"
+      cluster_key = 'localhost:2181:/hbase-test'
+      repl_impl = 'org.apache.hadoop.hbase.replication.ReplicationEndpointForTest'
       config_params = { "config1" => "value1", "config2" => "value2" }
-      args = { ENDPOINT_CLASSNAME => repl_impl, CONFIG => config_params}
+      args = { CLUSTER_KEY => cluster_key, ENDPOINT_CLASSNAME => repl_impl,
+               CONFIG => config_params }
       replication_admin.add_peer(@peer_id, args)
       peer_config = replication_admin.get_peer_config(@peer_id)
+      assert_equal(cluster_key, peer_config.get_cluster_key)
       assert_equal(repl_impl, peer_config.get_replication_endpoint_impl)
       assert_equal(2, peer_config.get_configuration.size)
       assert_equal("value1", peer_config.get_configuration.get("config1"))


Mime
View raw message