BewareMyPower commented on code in PR #25246:
URL: https://github.com/apache/pulsar/pull/25246#discussion_r2810915058
##########
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataCacheTest.java:
##########
@@ -739,4 +741,18 @@ public void testNoBackoffMetadataCacheConfig() {
assertTrue(backoff.isMandatoryStopMade());
assertEquals(backoff.getFirstBackoffTimeInMillis(), 0);
}
+
+ @Test
+ public void testRefreshRace() throws Exception {
+ @Cleanup final var store = new
LocalMemoryMetadataStore("memory:local", MetadataStoreConfig.builder().build());
+ final var cache = store.getMetadataCache(String.class);
+ for (int i = 0; i < 500; i++) {
+ final var key = "/key" + i;
+ assertTrue(cache.get(key).get().isEmpty());
+
+ store.put(key, "\"value\"".getBytes(StandardCharsets.UTF_8),
Optional.empty()).get();
+
Awaitility.await().pollInterval(Duration.ofMillis(1)).atMost(Duration.ofSeconds(3)).untilAsserted(()
->
Review Comment:
The `put` operation is called on the `MetadataStore` object. The
`MetadataCache#accept` method is not guaranteed to be called immediately after
the `put` operation is done because the notification callback is executed in
the dedicated `metadata-store-event` thread.
--
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]