From 0f49f1859dbc9919affb09d77d6997041e6c0583 Mon Sep 17 00:00:00 2001 From: hitesh Date: Fri, 8 Dec 2023 14:31:51 -0800 Subject: [PATCH] updated --- solr/core/src/java/org/apache/solr/cloud/ZkController.java | 7 +------ .../java/org/apache/solr/common/cloud/ZkStateReader.java | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java index 80a6d8c7efc..3ac2b45cc0c 100644 --- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java +++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java @@ -21,7 +21,6 @@ import static org.apache.solr.common.cloud.ZkStateReader.CORE_NAME_PROP; import static org.apache.solr.common.cloud.ZkStateReader.CORE_NODE_NAME_PROP; import static org.apache.solr.common.cloud.ZkStateReader.ELECTION_NODE_PROP; -import static org.apache.solr.common.cloud.ZkStateReader.HTTPS_PORT_PROP; import static org.apache.solr.common.cloud.ZkStateReader.NODE_NAME_PROP; import static org.apache.solr.common.cloud.ZkStateReader.REJOIN_AT_HEAD_PROP; import static org.apache.solr.common.cloud.ZkStateReader.SHARD_ID_PROP; @@ -408,11 +407,7 @@ public ZkController( // note: Can't read cluster properties until createClusterState ^ is called final String urlSchemeFromClusterProp = - zkStateReader.getClusterProperty( - ZkStateReader.URL_SCHEME, - StrUtils.isNotNullOrEmpty(System.getProperty(HTTPS_PORT_PROP)) - ? ZkStateReader.HTTPS - : ZkStateReader.HTTP); + zkStateReader.getClusterProperty(ZkStateReader.URL_SCHEME, ZkStateReader.HTTP); this.nodeName = generateNodeName( diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java index a9c71392f20..ead5a8aa8b7 100644 --- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java +++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java @@ -58,6 +58,7 @@ import org.apache.solr.common.util.ExecutorUtil; import org.apache.solr.common.util.ObjectReleaseTracker; import org.apache.solr.common.util.SolrNamedThreadFactory; +import org.apache.solr.common.util.StrUtils; import org.apache.solr.common.util.Utils; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException.NoNodeException; @@ -1149,6 +1150,12 @@ private void loadClusterProperties() { ClusterProperties.convertCollectionDefaultsToNestedFormat(properties); log.debug("Loaded cluster properties: {}", this.clusterProperties); + if (!this.clusterProperties.containsKey(URL_SCHEME)) { + if (StrUtils.isNotNullOrEmpty(System.getProperty(HTTPS_PORT_PROP))) { + this.clusterProperties.put(URL_SCHEME, "https"); + } + } + for (ClusterPropertiesListener listener : clusterPropertiesListeners) { listener.onChange(getClusterProperties()); }