How to run a datastore consistency check via oak-run

Learn how to run a datastore consistency check via oak-run in Adobe Experience Manager.

Description description

Environment

Adobe Experience Manager (AEM)

Issue

The data store consistency check will report any data store binaries that are missing but are still referenced. The consistency check can be triggered directly by Felix console.

It could be triggered from MarkSweepGarbageCollector#checkConsistency Mbean.

If the BlobGC MBeans are registered in the MBeanServer then the following mbean can also be used:

BlobGCMbean#checkConsistency

After the consistency check is complete, a message will show the number of binaries reported as missing. If the number is greater than 0(zero), check the logs configured for org.apache.jackrabbit.oak.plugins.blob .MarkSweepGarbageCollector for more details on the missing binaries.

Below is an example of how the missing binaries are reported in the logs:

11:32:39.673 INFO [ main]  MarkSweepGarbageCollector.java:600 Consistency check found 1 missing blobs 11:32:39.673 WARN [ main]  MarkSweepGarbageCollector.java:602 Consistency check failure in the the blob store : DataStore backed BlobStore [ org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore] , check missing candidates in file /tmp/gcworkdir-1467352959243/gccand-1467352959243

Unlike the /system/console/repositorycheck UI, the oak-run tool checks the hidden lucene index files under /oak: index in addition to the rest of the content paths. datastorecheck command of oak-run can be used to execute a consistency check on the datastore.  The detailed steps on how to execute the command are detailed below:

Resolution resolution

  1. Download oak-run jar 1.8.8 or later version to your AEM server.

  2. Place the oak run jar in the same directory where crx-quickstart is placed else provide the complete path of oak-run-*.jar while running below command.

  3. Run the command below (update the paths to the segmentstore and datastore as per your environment):

    code language-none
    java -jar oak-run-*.jar datastorecheck --consistency --ref --id --fds crx-quickstart/install/org.apache.jackrabbit.oak.plugins.blob.datastore.FileDataStore.config --repoHome crx-quickstart/repository --store crx-quickstart/repository/segmentstore --dump temp --verbose --track
    
  4. The command would output a datastore consistency check.

Consistency checker for the DataStore can also be used to list all the blob references in the node store and all the blob ids available in the data store. Use the following command:

$ java-jar oak-run-*.jar datastorecheck [ --id] [ --ref] [ --consistency] \

[ --store |] \

[ --s3ds |--fds] \

[ --dump] \

[ --track]

Provide one or more of the these available options:

–id - List all the ids in the data store.

–ref - List all the blob references in he node store.

–consistency - List all the missing blobs by doing a consistency check.

The following options are optional:

–store - Path to the segment store of mongo uri (Required for --ref and --consistency options above).

–dump - Path where to dump the files (Optional). Otherwise, files are dumped in the user tmp directory.

–s3ds - Path to the S3DataStore configuration file.

–fds - Path to the FileDataStore configuration file (‘path’ property is mandatory).

–track - Path of the local repository home folder (Optional). It places a copy of the downloaded blob ids to be tracked.

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