61yao commented on code in PR #10108:
URL: https://github.com/apache/pinot/pull/10108#discussion_r1084818130
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/GrpcMailboxService.java:
##########
@@ -44,16 +48,17 @@
* </ul>
*/
public class GrpcMailboxService implements MailboxService<TransferableBlock> {
+ private static final Duration MAILBOX_CACHE_EXPIRY = Duration.ofMinutes(5);
// channel manager
private final ChannelManager _channelManager;
private final String _hostname;
private final int _mailboxPort;
// maintaining a list of registered mailboxes.
- private final ConcurrentHashMap<String, ReceivingMailbox<TransferableBlock>>
_receivingMailboxMap =
- new ConcurrentHashMap<>();
- private final ConcurrentHashMap<String, SendingMailbox<TransferableBlock>>
_sendingMailboxMap =
- new ConcurrentHashMap<>();
+ private final Cache<String, ReceivingMailbox<TransferableBlock>>
_receivingMailboxCache =
+
CacheBuilder.newBuilder().expireAfterAccess(MAILBOX_CACHE_EXPIRY.toMinutes(),
TimeUnit.MINUTES).build();
Review Comment:
This doesn't work based on the doc here:
If
[expireAfterWrite](https://guava.dev/releases/18.0/api/docs/com/google/common/cache/CacheBuilder.html#expireAfterWrite(long,%20java.util.concurrent.TimeUnit))
or
[expireAfterAccess](https://guava.dev/releases/18.0/api/docs/com/google/common/cache/CacheBuilder.html#expireAfterAccess(long,%20java.util.concurrent.TimeUnit))
is requested entries may be evicted on each cache modification, on occasional
cache accesses, or on calls to
[Cache.cleanUp()](https://guava.dev/releases/18.0/api/docs/com/google/common/cache/Cache.html#cleanUp()).
Expired entries may be counted by
[Cache.size()](https://guava.dev/releases/18.0/api/docs/com/google/common/cache/Cache.html#size()),
but will never be visible to read or write operations.
Also the cleanup thread needs to be tied with query deadline.
--
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]