pkuwm commented on a change in pull request #863: Make ZkCacheBaseDataAccessor
and ZkHelixPropertyStore realm-aware
URL: https://github.com/apache/helix/pull/863#discussion_r388744803
##########
File path:
helix-core/src/main/java/org/apache/helix/manager/zk/ZkCacheBaseDataAccessor.java
##########
@@ -146,17 +161,55 @@ public ZkCacheBaseDataAccessor(String zkAddress,
ZkSerializer serializer, String
_wtCachePaths = wtCachePaths;
_zkCachePaths = zkCachePaths;
- // TODO: need to make sure no overlap between wtCachePaths and zkCachePaths
- // TreeMap key is ordered by key string length, so more general (i.e.
short) prefix
- // comes first
- _cacheMap = new TreeMap<>(new Comparator<String>() {
- @Override
- public int compare(String o1, String o2) {
- int len1 = o1.split("/").length;
- int len2 = o2.split("/").length;
- return len1 - len2;
- }
- });
+ start();
+ }
+
+ /**
+ * Constructor using a Builder that allows users to set connection and
client configs.
+ * @param builder
+ */
+ private ZkCacheBaseDataAccessor(Builder builder) {
+ _chrootPath = builder._chrootPath;
+ _wtCachePaths = builder._wtCachePaths;
+ _zkCachePaths = builder._zkCachePaths;
+
+ RealmAwareZkClient zkClient;
+ switch (builder._realmMode) {
+ case MULTI_REALM:
+ try {
+ zkClient = new
FederatedZkClient(builder._realmAwareZkConnectionConfig,
+ builder._realmAwareZkClientConfig);
+ break; // Must break out of the switch statement here
+ } catch (IOException | InvalidRoutingDataException |
IllegalStateException e) {
Review comment:
Do we need to validate zk address before falling back to single realm mode?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]