dcapwell commented on code in PR #2104:
URL: https://github.com/apache/cassandra/pull/2104#discussion_r1110205036
##########
src/java/org/apache/cassandra/streaming/StreamManager.java:
##########
@@ -260,10 +269,20 @@ public StreamManager()
logger.info("Storing streaming state for {} or for {} elements",
duration, numElements);
states = CacheBuilder.newBuilder()
.expireAfterWrite(duration.quantity(),
duration.unit())
- .maximumSize(numElements)
+ .maximumWeight(10 * 1024 *1024)
+ .weigher(new streamingStateWeigher())
.build();
}
+ private class streamingStateWeigher implements
Weigher<TimeUUID,StreamingState>
+ {
+ public int weigh(TimeUUID key, StreamingState val) {
+ long weight = ObjectSizes.measureDeep(val);
Review Comment:
to make this cleaner, you prob want to implement `IMeasurableMemory` in
StreamingState and just have this method call it, you can then compute the
logic there.
--
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]