kgeisz commented on code in PR #7857:
URL: https://github.com/apache/hbase/pull/7857#discussion_r2920280655
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/ActiveClusterSuffix.java:
##########
@@ -31,18 +34,40 @@
*/
@InterfaceAudience.Private
public class ActiveClusterSuffix {
- private final String active_cluster_suffix;
+ private final String cluster_id;
+ private final String suffix;
/**
* New ActiveClusterSuffix.
*/
- public ActiveClusterSuffix(final String cs) {
- this.active_cluster_suffix = cs;
+ public ActiveClusterSuffix(final String cs, final String suffix) {
+ this.cluster_id = cs;
+ this.suffix = suffix;
}
- public String getActiveClusterSuffix() {
- return active_cluster_suffix;
+ public ActiveClusterSuffix(final String input) {
+ String[] parts = input.split(":");
+ this.cluster_id = parts[0];
+ if (parts.length > 1) {
+ this.suffix = parts[1];
+ } else {
+ this.suffix = "";
+ }
+ }
+
+ public static ActiveClusterSuffix fromConfig(Configuration conf, ClusterId
clusterId) {
+ return new ActiveClusterSuffix(clusterId.toString(),
conf.get(HConstants.HBASE_META_TABLE_SUFFIX,
+ HConstants.HBASE_META_TABLE_SUFFIX_DEFAULT_VALUE));
Review Comment:
```suggestion
return new ActiveClusterSuffix(clusterId.toString(),
getSuffixFromConfig(conf));
```
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/ActiveClusterSuffix.java:
##########
@@ -31,18 +34,40 @@
*/
@InterfaceAudience.Private
public class ActiveClusterSuffix {
- private final String active_cluster_suffix;
+ private final String cluster_id;
+ private final String suffix;
/**
* New ActiveClusterSuffix.
*/
- public ActiveClusterSuffix(final String cs) {
- this.active_cluster_suffix = cs;
+ public ActiveClusterSuffix(final String cs, final String suffix) {
+ this.cluster_id = cs;
+ this.suffix = suffix;
}
- public String getActiveClusterSuffix() {
- return active_cluster_suffix;
+ public ActiveClusterSuffix(final String input) {
Review Comment:
What if the user puts a `:` in the cluster suffix? I think we should either
not allow the user to put a `:` in the suffix or parse on just the first `:`
(assuming cluster IDs never have a `:` in them).
##########
hbase-client/src/main/java/org/apache/hadoop/hbase/ActiveClusterSuffix.java:
##########
@@ -31,18 +34,40 @@
*/
@InterfaceAudience.Private
public class ActiveClusterSuffix {
- private final String active_cluster_suffix;
+ private final String cluster_id;
+ private final String suffix;
/**
* New ActiveClusterSuffix.
*/
Review Comment:
nit: remove blank line between docstring and constructor definition
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]