narendly commented on a change in pull request #1183:
URL: https://github.com/apache/helix/pull/1183#discussion_r464517443
##########
File path:
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
##########
@@ -1464,4 +1471,48 @@ private RealmAwareZkClient
resolveZkClient(HelixZkClientFactory zkClientFactory,
private String buildShardingKey() {
return _clusterName.charAt(0) == '/' ? _clusterName : "/" + _clusterName;
}
+
+ /**
+ * Check that not both zkAddress and ZkConnectionConfig are set.
+ * If zkAddress is not given and ZkConnectionConfig is given, check that
ZkConnectionConfig has
+ * a ZK path sharding key set because HelixManager must work on single-realm
mode.
+ * @param zkAddress
+ * @param helixManagerProperty
+ */
+ private void validateZkConnectionSettings(String zkAddress,
+ HelixManagerProperty helixManagerProperty) {
+ if (helixManagerProperty != null &&
helixManagerProperty.getZkConnectionConfig() != null) {
+ if (zkAddress != null && !zkAddress.isEmpty()) {
+ throw new HelixException(
+ "ZKHelixManager: cannot have both ZkAddress and ZkConnectionConfig
set!");
+ }
+ RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig =
+ helixManagerProperty.getZkConnectionConfig();
+ if (connectionConfig.getZkRealmShardingKey() == null || connectionConfig
+ .getZkRealmShardingKey().isEmpty()) {
+ throw new HelixException(
+ "ZKHelixManager::ZK path sharding key must be set for
ZKHelixManager! ZKHelixManager "
+ + "is only available on single-realm mode.");
+ }
+ _realmAwareZkConnectionConfig = connectionConfig;
+ }
+ }
+
+ /**
+ * Resolve ZK connection info for logging purposes.
+ * @return
+ */
+ private String getZkConnectionInfo() {
+ String zkConnectionInfo;
+ if (_zkAddress == null) {
+ if (_helixManagerProperty != null &&
_helixManagerProperty.getZkConnectionConfig() != null) {
+ zkConnectionInfo =
_helixManagerProperty.getZkConnectionConfig().toString();
+ } else {
+ zkConnectionInfo = "ZkAddr and ZkConnectionConfig are null!";
Review comment:
Changed to "None".
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]