Copilot commented on code in PR #16560:
URL: https://github.com/apache/pinot/pull/16560#discussion_r2263253320
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/channel/GrpcMailboxServer.java:
##########
@@ -121,4 +124,15 @@ public StreamObserver<Mailbox.MailboxContent>
open(StreamObserver<Mailbox.Mailbo
String mailboxId = ChannelUtils.MAILBOX_ID_CTX_KEY.get();
return new MailboxContentObserver(_mailboxService, mailboxId,
responseObserver);
}
+
+ @Override
+ public void ping(Mailbox.Ping request, StreamObserver<Mailbox.Pong>
responseObserver) {
+ LOGGER.debug("Received ping request: {}", request);
+ //super.ping(request, responseObserver);
Review Comment:
Remove the commented-out code. Dead code should be removed rather than
commented out.
```suggestion
```
##########
pinot-common/src/main/java/org/apache/pinot/common/config/GrpcConfig.java:
##########
@@ -23,7 +23,15 @@
import org.apache.pinot.common.utils.tls.TlsUtils;
import org.apache.pinot.spi.env.PinotConfiguration;
-
+/// Configs used for the gRPC **query** service.
+///
+/// Remember that in Pinot we use different gPRC services for different
purposes:
+/// - **query**: used by Pinot users for executing queries
+/// - **interla**: used by Pinot for internal communication between
servers/broker in MSE. This includes the ability
+/// to send query plans from broker to server, and the mailbox service for
sending data between servers/brokers.
+///
+/// This class only affects the **query** service. See ChannelManager,
MailboxService and GrpcMailboxServer to learn
+/// more about the Grpc config used for MSE.
Review Comment:
Use standard Javadoc syntax (/** */) instead of triple slashes (///) for
class documentation.
```suggestion
/**
* Configs used for the gRPC <b>query</b> service.
* <p>
* Remember that in Pinot we use different gRPC services for different
purposes:
* <ul>
* <li><b>query</b>: used by Pinot users for executing queries</li>
* <li><b>internal</b>: used by Pinot for internal communication between
servers/broker in MSE. This includes the ability
* to send query plans from broker to server, and the mailbox service
for sending data between servers/brokers.</li>
* </ul>
* <p>
* This class only affects the <b>query</b> service. See ChannelManager,
MailboxService and GrpcMailboxServer to learn
* more about the Grpc config used for MSE.
*/
```
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/MailboxSenderPinger.java:
##########
@@ -0,0 +1,106 @@
+/**
+ * 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.query.mailbox;
+
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.AbstractScheduledService;
+import io.grpc.stub.StreamObserver;
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.pinot.common.proto.Mailbox;
+import org.apache.pinot.common.proto.PinotMailboxGrpc;
+import org.apache.pinot.query.mailbox.channel.ChannelManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/// A scheduled service that periodically pings mailbox servers to ensure
their connections don't reach the idle state,
+/// which would mean we would need to re-establish the connection (including
TLS negotiation) before sending any,
+/// message, which increases the latency of the first query sent after a
period of inactivity.
Review Comment:
Use standard Javadoc syntax (/** */) instead of triple slashes (///) for
class documentation.
```suggestion
/**
* A scheduled service that periodically pings mailbox servers to ensure
their connections don't reach the idle state,
* which would mean we would need to re-establish the connection (including
TLS negotiation) before sending any
* message, which increases the latency of the first query sent after a
period of inactivity.
*/
```
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/channel/GrpcMailboxServer.java:
##########
@@ -121,4 +124,15 @@ public StreamObserver<Mailbox.MailboxContent>
open(StreamObserver<Mailbox.Mailbo
String mailboxId = ChannelUtils.MAILBOX_ID_CTX_KEY.get();
return new MailboxContentObserver(_mailboxService, mailboxId,
responseObserver);
}
+
+ @Override
+ public void ping(Mailbox.Ping request, StreamObserver<Mailbox.Pong>
responseObserver) {
+ LOGGER.debug("Received ping request: {}", request);
+ //super.ping(request, responseObserver);
+ Mailbox.Pong pong = Mailbox.Pong.newBuilder()
+ .setHostname(_mailboxService.getHostname())
+ .setPort(_mailboxService.getPort())
+ .build();
+ responseObserver.onNext(pong);
Review Comment:
Missing responseObserver.onCompleted() call after onNext(). The RPC will not
complete properly without calling onCompleted().
```suggestion
responseObserver.onNext(pong);
responseObserver.onCompleted();
```
##########
pinot-common/src/main/java/org/apache/pinot/common/config/GrpcConfig.java:
##########
@@ -23,7 +23,15 @@
import org.apache.pinot.common.utils.tls.TlsUtils;
import org.apache.pinot.spi.env.PinotConfiguration;
-
+/// Configs used for the gRPC **query** service.
+///
+/// Remember that in Pinot we use different gPRC services for different
purposes:
+/// - **query**: used by Pinot users for executing queries
+/// - **interla**: used by Pinot for internal communication between
servers/broker in MSE. This includes the ability
Review Comment:
Typo: 'interla' should be 'internal'
```suggestion
/// - **internal**: used by Pinot for internal communication between
servers/broker in MSE. This includes the ability
```
--
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]