-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-24764: Add support of adding default peer configs via hbase-site.xml for all replication peers. #2284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8510b99
HBASE-24764: Add support of adding default peer configs via hbase-sit…
4b83e2c
HBASE-24764: Moving logic to ReplicationPeerConfigUtil
b50ceab
Removing extra line
283a180
HBASE-24764: Addressing review comments
68b769e
HBASE-24764: Updating tests
d815e13
HBASE-24764: Fixing formatting issues
560154a
Review comments
6d5ac0f
HBASE-24764: Review comments and adding more tests
df48cb0
HBASE-24764: Remove extra lines
a65f3e4
HBASE-24764: Modifying test description
e2f08b0
HBASE-24764 : Review comments and adding more tests
20e3350
HBASE-24764 : Review Comments
9147c93
Remvoing shaded imports
eb9c543
HBASE-24764: Addressing review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
| import org.apache.hadoop.hbase.replication.ReplicationPeerDescription; | ||
| import org.apache.hadoop.hbase.replication.SyncReplicationState; | ||
| import org.apache.hadoop.hbase.util.Bytes; | ||
| import org.apache.hbase.thirdparty.com.google.common.base.Splitter; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
| import org.apache.yetus.audience.InterfaceStability; | ||
| import org.slf4j.Logger; | ||
|
|
@@ -60,6 +61,8 @@ | |
| public final class ReplicationPeerConfigUtil { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(ReplicationPeerConfigUtil.class); | ||
| public static final String HBASE_REPLICATION_PEER_BASE_CONFIG = | ||
| "hbase.replication.peer.base.config"; | ||
|
|
||
| private ReplicationPeerConfigUtil() {} | ||
|
|
||
|
|
@@ -450,6 +453,41 @@ public static ReplicationPeerConfig appendTableCFsToReplicationPeerConfig( | |
| return builder.build(); | ||
| } | ||
|
|
||
| /** | ||
| * 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 | ||
| * @return ReplicationPeerConfig containing updated configs. | ||
| */ | ||
| public static ReplicationPeerConfig addBasePeerConfigsIfNotPresent(Configuration conf, | ||
| ReplicationPeerConfig receivedPeerConfig) { | ||
| String basePeerConfigs = conf.get(HBASE_REPLICATION_PEER_BASE_CONFIG, ""); | ||
| ReplicationPeerConfigBuilder copiedPeerConfigBuilder = ReplicationPeerConfig. | ||
| newBuilder(receivedPeerConfig); | ||
| Map<String,String> receivedPeerConfigMap = receivedPeerConfig.getConfiguration(); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Remove multiple extraneous new lines in this method. |
||
| 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 peer configs | ||
| if (!receivedPeerConfigMap.containsKey(configName)) { | ||
| copiedPeerConfigBuilder.putConfiguration(configName, configValue); | ||
| } | ||
| } | ||
| } | ||
| return copiedPeerConfigBuilder.build(); | ||
| } | ||
|
|
||
| public static ReplicationPeerConfig appendExcludeTableCFsToReplicationPeerConfig( | ||
| Map<TableName, List<String>> excludeTableCfs, ReplicationPeerConfig peerConfig) | ||
| throws ReplicationException { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.