sashapolo commented on code in PR #5403:
URL: https://github.com/apache/ignite-3/pull/5403#discussion_r1992159356
##########
modules/metastorage-cache/src/main/java/org/apache/ignite/internal/metastorage/cache/IdempotentCacheVacuumizer.java:
##########
@@ -113,8 +112,9 @@ public CompletableFuture<Void> startAsync(ComponentContext
componentContext) {
() -> {
if (triggerVacuumization.get()) {
try {
-
vacuumizationAction.accept(hybridTimestamp(clockService.nowLong()
- - (idempotentCacheTtl.value() +
clockService.maxClockSkewMillis())));
+ vacuumizationAction.accept(clockService.now()
Review Comment:
Could you please extract the time calculation into an intermediate variable?
It would make the code easier to read.
##########
modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/impl/ItIdempotentCommandCacheTest.java:
##########
@@ -458,8 +458,9 @@ public void
testIdempotentCacheRestoreFromSnapshot(IdempotentCommand idempotentC
), willCompleteSuccessfully());
}
- HybridTimestamp evictionTimestamp =
HybridTimestamp.hybridTimestamp(nodes.get(0).clockService.nowLong()
- - (raftConfiguration.retryTimeout().value() +
nodes.get(0).clockService.maxClockSkewMillis()));
+ HybridTimestamp evictionTimestamp =
nodes.get(0).clockService.now().subtractPhysicalTime(
Review Comment:
please extract `nodes.get(0).clockService` into a variable
##########
modules/metastorage-cache/src/test/java/org/apache/ignite/internal/metastorage/cache/IdempotentCacheVacuumizerTest.java:
##########
@@ -79,6 +82,42 @@ public void tearDown() {
scheduler.shutdown();
}
+ /**
+ * Tests that ttl and clock skew are properly taken into account while
calculating an eviction timestamp.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testIdempotentCacheVacuumizerTtl() throws Exception {
+ AtomicReference<HybridTimestamp> evictionTimestamp = new
AtomicReference<>();
+
+ long ttl = 10L;
+ when(idempotentCacheTtlConfigurationValue.value()).thenReturn(ttl);
+
+ assertEquals(ttl, idempotentCacheTtlConfigurationValue.value());
Review Comment:
What is this check for? Are you testing mockito?
--
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]