DataStore GarbageCollection Task fails with error

Discover how to overcome DataStore GarbageCollection task errors by removing the registered repository id.

Description description

Environment

Adobe Experience Manager (AEM)

Issue/Symptoms

DataStoreGarbageCollectionTask fails with the below error:

*ERROR* [ sling-oak-observation-19]  org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector Not all repositories have marked
references available : [ e0fb2a15-d5d5-4013-9607-0fb89cf87c94]
26.07.2022 20:56:50.737 *ERROR* [ sling-oak-observation-19]  org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector Blob garbage collection error
java.io.IOException: Not all repositories have marked references available
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector$GarbageCollectionType$1.mergeAllMarkedReferences(MarkSweepGarbageCollector.java:7
22) [ org.apache.jackrabbit.oak-blob-plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector.sweep(MarkSweepGarbageCollector.java:384) [ org.apache.jackrabbit.oak-blob-plugins
:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector.markAndSweep(MarkSweepGarbageCollector.java:284) [ org.apache.jackrabbit.oak-blob-
plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector.collectGarbage(MarkSweepGarbageCollector.java:191) [ org.apache.jackrabbit.oak-blo
b-plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.BlobGC$1.call(BlobGC.java:87) [ org.apache.jackrabbit.oak-blob-plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.BlobGC$1.call(BlobGC.java:83) [ org.apache.jackrabbit.oak-blob-plugins:1.8.21]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
26.07.2022 20:56:51.620 *ERROR* [ pool-20-thread-1]  org.apache.jackrabbit.oak.commons.jmx.ManagementOperation Blob garbage collection failed
java.io.IOException: Not all repositories have marked references available
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector$GarbageCollectionType$1.mergeAllMarkedReferences(MarkSweepGarbageCollector.java:7
22) [ org.apache.jackrabbit.oak-blob-plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector.sweep(MarkSweepGarbageCollector.java:384) [ org.apache.jackrabbit.oak-blob-plugins
:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector.markAndSweep(MarkSweepGarbageCollector.java:284) [ org.apache.jackrabbit.oak-blob-
plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector.collectGarbage(MarkSweepGarbageCollector.java:191) [ org.apache.jackrabbit.oak-blo
b-plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.BlobGC$1.call(BlobGC.java:87) [ org.apache.jackrabbit.oak-blob-plugins:1.8.21]
        at org.apache.jackrabbit.oak.plugins.blob.BlobGC$1.call(BlobGC.java:83) [ org.apache.jackrabbit.oak-blob-plugins:1.8.21]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
26.07.2022 20:56:51.628 *INFO* [ pool-20-thread-1]  com.adobe.granite.maintenance.impl.MaintenanceJobsManagerImpl Name='DataStoreGarbageCollectionTask', Status
='ERROR', Result='Data store GC: Operation failed Blob garbage collection failed: Not all repositories have marked references available', Details='{"created"
:1658858205603,"started":1658858205603,"finished":1658858211620,"duration":6017}'

Resolution resolution

This issue might occur if you had a previous instance using the datastore, which was destroyed and a new instance created to use the datastore.

The issue can be resolved after removing repository id registered in the datastore. Blob store GC then should complete successfully.

Step-by-step guide:

1)Go to datastore path  < aem-install-folder> /crx-quickstart/repository/datastore and search for repository id e0fb2a15-d5d5-4013-9607-0fb89cf87c94 (it should be same as the one mentioned in error.log ERROR* [ sling-oak-observation-19] org.apache.jackrabbit.oak.plugins.blob.MarkSweepGarbageCollector Not all repositories have marked
references available : [ e0fb2a15-d5d5-4013-9607-0fb89cf87c94] ),  you will have a reference file with this name, just delete that reference file (repeat these steps if there are multiple files).

2)Run the GC again and check if it resolves the issue.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f