stefan-egli commented on code in PR #1562:
URL: https://github.com/apache/jackrabbit-oak/pull/1562#discussion_r1665651871
##########
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java:
##########
@@ -1478,6 +1477,77 @@ private Iterator<NodeDocument> candidates(long
fromModified, long toModified, in
// OAK-10199 END
+ // OAK-10921
+ @Test
+ public void resetFullGCFromOakRunWhileRunning() throws Exception {
+
+ // if we reset fullGC from any external source while GC is running,
+ // it should not update the fullGC variables.
+
+ //1. Create nodes with properties
+ NodeBuilder b1 = store1.getRoot().builder();
+
+ // Add property to node & save
+ for (int i = 0; i < 5; i++) {
+ b1.child("z"+i).setProperty("prop", "foo", STRING);
+ }
+ store1.merge(b1, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+ store1.runBackgroundOperations();
+
+ // enable the full gc flag
+ writeField(gc, "fullGCEnabled", true, true);
+ long maxAge = 1; //hours
+ long delta = MINUTES.toMillis(10);
+ //1. Go past GC age and check no GC done as nothing deleted
+ clock.waitUntil(getCurrentTimestamp() + maxAge);
+ VersionGCStats stats = gc(gc, maxAge, HOURS);
+ assertStatsCountsZero(stats);
+
+ //Remove property
+ NodeBuilder b2 = store1.getRoot().builder();
+ for (int i = 0; i < 5; i++) {
+ b2.getChildNode("z"+i).removeProperty("prop");
+ }
+ store1.merge(b2, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+ store1.runBackgroundOperations();
+
+ final AtomicReference<VersionGarbageCollector> gcRef =
Atomics.newReference();
+ final VersionGCSupport gcSupport = new
VersionGCSupport(store1.getDocumentStore()) {
+
+ @Override
+ public Iterable<NodeDocument> getModifiedDocs(long fromModified,
long toModified, int limit, @NotNull String fromId,
+ final @NotNull
Set<String> includePaths, final @NotNull Set<String> excludePaths) {
+ // reset fullGC variables externally while GC is running
+ store1.getDocumentStore().remove(SETTINGS,
SETTINGS_COLLECTION_ID);
Review Comment:
I see the new `resetFullGCFromOakRunWhileRunning` is virtually identical to
`resetGCFromOakRunWhileRunning` except for `reset()` vs `resetFullGC()` - which
was the idea of course - but I would suggest to consider refactoring these two
to avoid (test) code duplication - drafted this (without testing) in
https://github.com/apache/jackrabbit-oak/pull/1572 to illustrate
--
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]