You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2021/02/25 00:40:13 UTC

[hbase] branch master updated: HBASE-25602 Fix broken TestReplicationShell on master (#2981)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new ed2693f  HBASE-25602 Fix broken TestReplicationShell on master (#2981)
ed2693f is described below

commit ed2693f12354674c6b6483e387d7e8edb764fba0
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Thu Feb 25 08:39:34 2021 +0800

    HBASE-25602 Fix broken TestReplicationShell on master (#2981)
    
    Signed-off-by: Peter Somogyi <ps...@apache.org>
---
 .../src/main/ruby/hbase/replication_admin.rb       | 23 +++++++++++-----------
 .../hadoop/hbase/client/TestReplicationShell.java  |  3 ---
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/hbase-shell/src/main/ruby/hbase/replication_admin.rb b/hbase-shell/src/main/ruby/hbase/replication_admin.rb
index c788835..ce9f4c7 100644
--- a/hbase-shell/src/main/ruby/hbase/replication_admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/replication_admin.rb
@@ -178,8 +178,9 @@ module Hbase
         end
         rpc = get_peer_config(id)
         unless rpc.nil?
-          rpc.setTableCFsMap(map)
-          @admin.updateReplicationPeerConfig(id, rpc)
+          builder = ReplicationPeerConfig.newBuilder(rpc)
+          builder.setTableCFsMap(map)
+          @admin.updateReplicationPeerConfig(id, builder.build)
         end
       end
     end
@@ -251,8 +252,9 @@ module Hbase
         end
         rpc = get_peer_config(id)
         unless rpc.nil?
-          rpc.setNamespaces(ns_set)
-          @admin.updateReplicationPeerConfig(id, rpc)
+          builder = ReplicationPeerConfig.newBuilder(rpc)
+          builder.setNamespaces(ns_set)
+          @admin.updateReplicationPeerConfig(id, builder.build)
         end
       end
     end
@@ -311,10 +313,9 @@ module Hbase
     # Set new bandwidth config for the specified peer
     def set_peer_bandwidth(id, bandwidth)
       rpc = get_peer_config(id)
-      unless rpc.nil?
-        rpc.setBandwidth(bandwidth)
-        @admin.updateReplicationPeerConfig(id, rpc)
-      end
+      return if rpc.nil?
+      rpc = ReplicationPeerConfig.newBuilder(rpc).setBandwidth(bandwidth).build
+      @admin.updateReplicationPeerConfig(id, rpc)
     end
 
     # Append exclude namespaces config for the specified peer
@@ -359,7 +360,7 @@ module Hbase
     def set_peer_replicate_all(id, replicate_all)
       rpc = get_peer_config(id)
       return if rpc.nil?
-      rpc.setReplicateAllUserTables(replicate_all)
+      rpc = ReplicationPeerConfig.newBuilder(rpc).setReplicateAllUserTables(replicate_all).build
       @admin.updateReplicationPeerConfig(id, rpc)
     end
 
@@ -381,7 +382,7 @@ module Hbase
       end
       rpc = get_peer_config(id)
       return if rpc.nil?
-      rpc.setExcludeNamespaces(exclude_ns_set)
+      rpc = ReplicationPeerConfig.newBuilder(rpc).setExcludeNamespaces(exclude_ns_set).build
       @admin.updateReplicationPeerConfig(id, rpc)
     end
 
@@ -404,7 +405,7 @@ module Hbase
       end
       rpc = get_peer_config(id)
       return if rpc.nil?
-      rpc.setExcludeTableCFsMap(map)
+      rpc = ReplicationPeerConfig.newBuilder(rpc).setExcludeTableCFsMap(map).build
       @admin.updateReplicationPeerConfig(id, rpc)
     end
 
diff --git a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
index 146a73f..68b5c67 100644
--- a/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
+++ b/hbase-shell/src/test/java/org/apache/hadoop/hbase/client/TestReplicationShell.java
@@ -17,13 +17,10 @@
  */
 package org.apache.hadoop.hbase.client;
 
-import java.io.IOException;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.ClientTests;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.jruby.embed.PathType;
 import org.junit.ClassRule;
-import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({ ClientTests.class, LargeTests.class })