61yao commented on code in PR #10099: URL: https://github.com/apache/pinot/pull/10099#discussion_r1072501053
########## pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/channel/MailboxContentStreamObserver.java: ########## @@ -59,13 +63,32 @@ private static Mailbox.MailboxContent createErrorContent(Throwable e) private final boolean _isEnabledFeedback; private final AtomicBoolean _isCompleted = new AtomicBoolean(false); - private final ArrayBlockingQueue<Mailbox.MailboxContent> _receivingBuffer; - - ReadWriteLock _errorLock = new ReentrantReadWriteLock(); - private Mailbox.MailboxContent _errorContent = null; // Guarded by _errorLock. + private final BlockingQueue<Mailbox.MailboxContent> _receivingBuffer; + + private ReadWriteLock _bufferSizeLock = new ReentrantReadWriteLock(); + @GuardedBy("bufferSizeLock") + private int _maxBufferSize = 0; + private ReadWriteLock _errorLock = new ReentrantReadWriteLock(); + @GuardedBy("_errorLock") + private Mailbox.MailboxContent _errorContent = null; private StringMailboxIdentifier _mailboxId; private Consumer<MailboxIdentifier> _gotMailCallback; + private void updateMaxBufferSize() { + _bufferSizeLock.writeLock().lock(); + _maxBufferSize = max(_maxBufferSize, _receivingBuffer.size()); + _bufferSizeLock.writeLock().unlock(); + } + + private int getMaxBufferSize() { + try { + _bufferSizeLock.readLock().lock(); + return _maxBufferSize; + } finally { + _bufferSizeLock.readLock().unlock(); + } + } Review Comment: yes. it is unsafe even for debugging purpose -- 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-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org