You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/10/14 06:10:53 UTC

[GitHub] [pinot] ankitsultana commented on a diff in pull request #9484: [multistage] Introduce InMemoryMailboxService for Optimizing Join Performance

ankitsultana commented on code in PR #9484:
URL: https://github.com/apache/pinot/pull/9484#discussion_r995376873


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/channel/InMemoryChannel.java:
##########
@@ -0,0 +1,51 @@
+/**
+ * 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.channel;
+
+import java.util.concurrent.ArrayBlockingQueue;
+
+
+/**
+ * Used by {@link org.apache.pinot.query.mailbox.InMemoryMailboxService} for passing data between stages when sender
+ * and receiver are in the same process.
+ */
+public class InMemoryChannel<T> {
+  private final ArrayBlockingQueue<T> _channel;
+  private final String _hostname;
+  private final int _port;
+  private boolean _completed = false;
+
+  public InMemoryChannel(ArrayBlockingQueue<T> channel, String hostname, int port) {
+    _channel = channel;
+    _hostname = hostname;
+    _port = port;
+  }
+
+  public ArrayBlockingQueue<T> getChannel() {
+    return _channel;
+  }

Review Comment:
   In `MailboxReceiveOperator` we check if the mailbox is closed. For `InMemoryReceivingMailbox`, we need to confirm that:
   
   1. The sender is done sending. When the sender is done, it will call complete here.
   2. The ArrayBlockingQueue is empty.
   
   If both of these are true, then we say that the mailbox is closed. I think this is actually equivalent to `MailboxContentStreamObserver` and not the channel itself.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org