bharathv commented on a change in pull request #2327:
URL: https://github.com/apache/hbase/pull/2327#discussion_r489574840
##########
File path:
hbase-client/src/main/java/org/apache/hadoop/hbase/replication/ReplicationPeerConfig.java
##########
@@ -99,6 +105,36 @@ public ReplicationPeerConfig setBandwidth(long bandwidth) {
return this;
}
+ /**
+ * Helper method to add base peer configs from Configuration to
ReplicationPeerConfig
+ * if not present in latter.
+ *
+ * This merges the user supplied peer configuration
+ * {@link org.apache.hadoop.hbase.replication.ReplicationPeerConfig} with
peer configs
+ * provided as property hbase.replication.peer.base.configs in hbase
configuration.
+ * Expected format for this hbase configuration is "k1=v1;k2=v2,v2_1".
Original value
+ * of conf is retained if already present in ReplicationPeerConfig.
+ *
+ * @param conf Configuration
+ */
+ public void addBasePeerConfigsIfNotPresent(Configuration conf) {
+ String basePeerConfigs = conf.get(HBASE_REPLICATION_PEER_BASE_CONFIG, "");
+ Map<String,String> receivedPeerConfigMap = this.getConfiguration();
+
+ if (basePeerConfigs.length() != 0) {
+ Map<String, String> basePeerConfigMap =
Splitter.on(';').trimResults().omitEmptyStrings()
+ .withKeyValueSeparator("=").split(basePeerConfigs);
+ for (Map.Entry<String,String> entry : basePeerConfigMap.entrySet()) {
+ String configName = entry.getKey();
+ String configValue = entry.getValue();
+ // Only override if base config does not exist in existing replication
peer configs
+ if (!receivedPeerConfigMap.containsKey(configName)) {
Review comment:
nit: just use this.configuration directly?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]