-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to have different instances LocalMemoryMetadataStore that share the same state #12390
Conversation
return FutureUtils.exception(new MetadataStoreException("")); | ||
private static final Map<String, NavigableMap<String, Value>> STATIC_MAPS = new MapMaker() | ||
.weakValues().makeMap(); | ||
private static final Map<String, AtomicLong> STATIC_ID_GEN_MAP = new MapMaker() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why weak values?
This will make tests possible unpredictable, because eviction will depend on GC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a static map, so it would be never cleaned up otherwise.
It will not make the test unpredictable because there will be hard references to the map value for each instance of LocalMemoryMetadataStore
that will keep it from getting GCed.
return FutureUtils.exception(new MetadataStoreException("")); | ||
private static final Map<String, NavigableMap<String, Value>> STATIC_MAPS = new MapMaker() | ||
.weakValues().makeMap(); | ||
private static final Map<String, AtomicLong> STATIC_ID_GEN_MAP = new MapMaker() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why weak values?
This will make tests possible unpredictable, because eviction will depend on GC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
* up/master: [C++] Fixed connection read error logging (apache#12492) [Pulsar SQL] Pulsar SQL support query big entry data (apache#12448) [Java Client] Remove data race in MultiTopicsConsumerImpl to ensure correct message order (apache#12456) Allow to have different instances LocalMemoryMetadataStore that share the same state (apache#12390) Remove unused ConsumerImpl.isTxnMessage (apache#12472)
|
||
store2.delete("/test", Optional.empty()).join(); | ||
|
||
assertFalse(store1.exists("/test").join()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merlimat Not sure why here can get passed, 2 instance only shared the data but not the cache, after deleted data from one instance, the cache data of another instance will not be removed, so the test will get failed.
Motivation
Added the possibility to specify a name when creating instances of
LocalMemoryMetadataStore
so that they can refer to the same memory.This is useful when setting up tests for which the components are instantiating the
MetadataStore
on their own, but we still want them to share the state (eg: brokers and bookies).