Jackie-Jiang commented on code in PR #17358:
URL: https://github.com/apache/pinot/pull/17358#discussion_r2692297426


##########
pinot-core/src/main/java/org/apache/pinot/core/instance/context/BrokerContext.java:
##########
@@ -0,0 +1,98 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.instance.context;
+
+import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext;
+import java.util.Objects;
+import javax.annotation.Nullable;
+import javax.net.ssl.SSLContext;
+
+
+/**
+ * The <code>BrokerContext</code> class is a singleton class which contains 
all broker related context.
+ */
+public class BrokerContext {
+  private static final BrokerContext INSTANCE = new BrokerContext();
+
+  private BrokerContext() {
+  }
+
+  public static BrokerContext getInstance() {
+    return INSTANCE;
+  }
+
+  @Nullable
+  // Stored as Object to avoid a pinot-core dependency on query-runtime types 
(e.g.
+  // 
org.apache.pinot.query.runtime.operator.factory.QueryOperatorFactoryProvider).

Review Comment:
   (minor)
   ```suggestion
     // This Object should be of type 
org.apache.pinot.query.runtime.operator.factory.QueryOperatorFactoryProvider
   ```



##########
pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java:
##########
@@ -398,6 +401,17 @@ public void start()
       TlsConfig tlsDefaults = null;
       if (_brokerConf.getProperty(Broker.BROKER_NETTYTLS_ENABLED, false)) {
         tlsDefaults = TlsUtils.extractTlsConfig(_brokerConf, 
Broker.BROKER_TLS_PREFIX);
+        SSLFactory sslFactory =
+            
RenewableTlsUtils.createSSLFactoryAndEnableAutoRenewalWhenUsingFileStores(tlsDefaults,
+                PinotInsecureMode::isPinotInInsecureMode);
+        SSLContext sslContext = sslFactory.getSslContext();
+        BrokerContext brokerContext = BrokerContext.getInstance();
+        if (brokerContext.getClientHttpsContext() == null) {

Review Comment:
   We shouldn't add this check. We can either throw exception, or at least log 
warning/error when the value is overridden. Same for other places



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java:
##########
@@ -166,6 +173,25 @@ public MultiStageBrokerRequestHandler(PinotConfiguration 
config, String brokerId
     TlsConfig tlsConfig = 
config.getProperty(CommonConstants.Helix.CONFIG_OF_MULTI_STAGE_ENGINE_TLS_ENABLED,
         CommonConstants.Helix.DEFAULT_MULTI_STAGE_ENGINE_TLS_ENABLED) ? 
TlsUtils.extractTlsConfig(config,
         CommonConstants.Broker.BROKER_TLS_PREFIX) : null;
+    if (tlsConfig != null) {

Review Comment:
   This is anti-pattern. We shouldn't set this in both broker starter and 
request handler.
   
   Do you see we potentially enable TLS only for SSE/MSE but not both? We need 
to figure out a way to ensure it is only initialized once



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to