This is an automated email from the ASF dual-hosted git repository.

rishabhdaim pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 0a4ecb3e34 OAK-12288 : disabled blob id tracking for segment node 
store (#2985)
0a4ecb3e34 is described below

commit 0a4ecb3e346d81699567a82c0a19b2865b2576b8
Author: Rishabh Kumar <[email protected]>
AuthorDate: Tue Jun 30 17:30:39 2026 +0530

    OAK-12288 : disabled blob id tracking for segment node store (#2985)
    
    * OAK-12288 : disabled blob id tracking for segment node store
    
    * OAK-12288 : updated docs with latest behaviour
---
 .../oak/plugins/blob/datastore/BlobIdTrackerTest.java    | 13 +++++++++++++
 oak-doc/src/site/markdown/osgi_config.md                 |  4 +++-
 oak-doc/src/site/markdown/plugins/blobstore.md           | 10 ++++++++++
 .../jackrabbit/oak/segment/SegmentNodeStoreFactory.java  |  2 +-
 .../jackrabbit/oak/segment/SegmentNodeStoreService.java  |  2 +-
 .../oak/segment/SegmentBlobTrackerRegistrationTest.java  |  3 +++
 .../oak/segment/osgi/SegmentNodeStoreFactoryTest.java    | 16 ++++++++++++++++
 .../oak/segment/osgi/SegmentNodeStoreServiceTest.java    |  4 ++--
 8 files changed, 49 insertions(+), 5 deletions(-)

diff --git 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerTest.java
 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerTest.java
index f436d0358a..81d761194d 100644
--- 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerTest.java
+++ 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/datastore/BlobIdTrackerTest.java
@@ -229,6 +229,19 @@ public class BlobIdTrackerTest {
         }
     }
 
+    @Test
+    public void zeroSnapshotIntervalBuildsNoOpTracker() throws Exception {
+        LOG.info("In zeroSnapshotIntervalBuildsNoOpTracker");
+
+        BlobIdTracker noOpTracker = 
BlobIdTracker.build(root.getAbsolutePath(), repoId + "-noop", 0, dataStore);
+        closer.register(noOpTracker);
+
+        noOpTracker.add("id1");
+        noOpTracker.add(java.util.Collections.singletonList("id2").iterator());
+
+        assertTrue("No-op tracker must return empty iterator from get()", 
!noOpTracker.get().hasNext());
+    }
+
     @Test
     public void externalAddOffline() throws Exception {
         LOG.info("In externalAddOffline");
diff --git a/oak-doc/src/site/markdown/osgi_config.md 
b/oak-doc/src/site/markdown/osgi_config.md
index 0b8ae52598..89259d9fb0 100644
--- a/oak-doc/src/site/markdown/osgi_config.md
+++ b/oak-doc/src/site/markdown/osgi_config.md
@@ -224,11 +224,13 @@ For example, as per default, only those BLOBs which have 
been created 24 hours i
   minimum. This is to ensure that the NodeStore(s) have had the time to flush 
out its internal data structures to 
   persistence and the references to recently added blobs are accounted.
 
-blobTrackSnapshotIntervalInSecs (long) - 43200
+blobTrackSnapshotIntervalInSecs (long) - 0
 : The blob ids cached/tracked locally are synchronized with the DataStore at 
this interval. Any additions and 
 deletions will be visible to other cluster nodes or repositories connected to 
the shared DatStore after this. This 
 should be less than the blobGcMaxAgeInSecs parameter above and the frequency 
of blob gc. See [Blob 
 tracker][blobtracker].
+A value of `0` (the default since Oak 2.4.0) disables blob ID tracking 
entirely for the Segment Node Store. To enable tracking,
+set this to a positive value (e.g. `43200` for 12 hours). Note that 
DocumentNodeStore defaults to `43200`.
 
 <a name="document-node-store"></a>
 #### DocumentNodeStore
diff --git a/oak-doc/src/site/markdown/plugins/blobstore.md 
b/oak-doc/src/site/markdown/plugins/blobstore.md
index 239d058e5a..85773f6df4 100644
--- a/oak-doc/src/site/markdown/plugins/blobstore.md
+++ b/oak-doc/src/site/markdown/plugins/blobstore.md
@@ -234,6 +234,16 @@ other cluster nodes or different repositories sharing the 
datastore to get a con
 interval of synchronization is defined by the OSGi configuration parameter 
`blobTrackSnapshotIntervalInSecs` for the 
 configured NodeStore services.
 
+**Default behavior by NodeStore:**
+
+* **SegmentNodeStore** (`SegmentNodeStoreService` / 
`SegmentNodeStoreFactory`): blob ID tracking is **disabled by
+  default** (`blobTrackSnapshotIntervalInSecs = 0`). To enable it, set a 
positive value such as `43200` (12 hours).
+* **DocumentNodeStore**: blob ID tracking is **enabled by default** with a 
12-hour sync interval
+  (`blobTrackSnapshotIntervalInSecs = 43200`).
+
+When tracking is disabled (interval = 0), blob IDs are not cached locally and 
the warnings described below do
+not apply. The full blob ID list is always retrieved directly from the 
DataStore during GC.
+
 If 2 garbage collection cycles are executed within the 
`blobTrackSnapshotIntervalInSecs` then there may be warnings 
 in the logs of some missing blob ids which is due to the fact that the 
deletions due to earlier gc has not been 
 synchronized with the data store. It's ok to either ignore these warnings or 
to adjust the `blobTrackSnapshotIntervalInSecs` 
diff --git 
a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreFactory.java
 
b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreFactory.java
index 9444acc1b8..8de93777de 100644
--- 
a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreFactory.java
+++ 
b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreFactory.java
@@ -80,7 +80,7 @@ public class SegmentNodeStoreFactory {
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private static final long DEFAULT_BLOB_SNAPSHOT_INTERVAL = 12 * 60 * 60;
+    private static final long DEFAULT_BLOB_SNAPSHOT_INTERVAL = 0L;
 
     private static final long DEFAULT_BLOB_GC_MAX_AGE = 24 * 60 * 60;
 
diff --git 
a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.java
 
b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.java
index ab8ab1dd96..1842cb85f2 100644
--- 
a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.java
+++ 
b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.java
@@ -80,7 +80,7 @@ public class SegmentNodeStoreService {
     // TODO(frm) This is only exposed to tests. Should it be removed?
     public static final String REPOSITORY_HOME_DIRECTORY = "repository.home";
 
-    private static final long DEFAULT_BLOB_SNAPSHOT_INTERVAL = 12 * 60 * 60;
+    private static final long DEFAULT_BLOB_SNAPSHOT_INTERVAL = 0L;
 
     private static final long DEFAULT_BLOB_GC_MAX_AGE = 24 * 60 * 60;
 
diff --git 
a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBlobTrackerRegistrationTest.java
 
b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBlobTrackerRegistrationTest.java
index 0bea531226..9323702aca 100644
--- 
a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBlobTrackerRegistrationTest.java
+++ 
b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/SegmentBlobTrackerRegistrationTest.java
@@ -44,6 +44,9 @@ public class SegmentBlobTrackerRegistrationTest extends 
AbstractBlobTrackerRegis
         Hashtable<String, Object> properties = new Hashtable<>();
         properties.put(SegmentNodeStoreService.CUSTOM_BLOB_STORE, true);
         properties.put(SegmentNodeStoreService.REPOSITORY_HOME_DIRECTORY, 
repoHome);
+        // Explicitly enable blob ID tracking (default is 0/disabled since Oak 
2.4.0).
+        // This test verifies tracker reinitialization which requires an 
active tracker.
+        properties.put("blobTrackSnapshotIntervalInSecs", 3600L);
         SegmentNodeStoreService service = new SegmentNodeStoreService();
         
         // OAK-10367: The call 
diff --git 
a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreFactoryTest.java
 
b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreFactoryTest.java
index d1708c4127..a3304ad71c 100644
--- 
a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreFactoryTest.java
+++ 
b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreFactoryTest.java
@@ -46,6 +46,14 @@ public class SegmentNodeStoreFactoryTest {
             .withBooleanType()
             .withValue("false")
             .check());
+        assertTrue(cd.hasProperty("blobGcMaxAgeInSecs")
+            .withLongType()
+            .withValue("86400")
+            .check());
+        assertTrue(cd.hasProperty("blobTrackSnapshotIntervalInSecs")
+            .withLongType()
+            .withValue("0")
+            .check());
         assertTrue(cd.hasReference("blobStore")
             .withInterface("org.apache.jackrabbit.oak.spi.blob.BlobStore")
             .withOptionalUnaryCardinality()
@@ -97,6 +105,14 @@ public class SegmentNodeStoreFactoryTest {
             .withBooleanType()
             .withDefaultValue("false")
             .check());
+        assertTrue(ocd.hasAttributeDefinition("blobGcMaxAgeInSecs")
+            .withLongType()
+            .withDefaultValue("86400")
+            .check());
+        
assertTrue(ocd.hasAttributeDefinition("blobTrackSnapshotIntervalInSecs")
+            .withLongType()
+            .withDefaultValue("0")
+            .check());
     }
 
 }
diff --git 
a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreServiceTest.java
 
b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreServiceTest.java
index 3a45c47db2..135a9f17da 100644
--- 
a/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreServiceTest.java
+++ 
b/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/osgi/SegmentNodeStoreServiceTest.java
@@ -115,7 +115,7 @@ public class SegmentNodeStoreServiceTest {
             .check());
         assertTrue(cd.hasProperty("blobTrackSnapshotIntervalInSecs")
             .withLongType()
-            .withValue("43200")
+            .withValue("0")
             .check());
         assertTrue(cd.hasReference("blobStore")
             .withInterface("org.apache.jackrabbit.oak.spi.blob.BlobStore")
@@ -236,7 +236,7 @@ public class SegmentNodeStoreServiceTest {
             .check());
         
assertTrue(ocd.hasAttributeDefinition("blobTrackSnapshotIntervalInSecs")
             .withLongType()
-            .withDefaultValue("43200")
+            .withDefaultValue("0")
             .check());
     }
 

Reply via email to