How to run a datastore consistency check via oak-run

Description

The oak-run tool is helpful when you observe an error like this one:

09.11.2017 13:42:17.512 *WARN* async-index-update-async org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore Error occurred while loading bytes from steam while fetching for id 4089b47c7ba7ab8015859428e7e6965eec4641e3#241

java.util.concurrent.ExecutionException: java.io.IOException: org.apache.jackrabbit.core.data.DataStoreException: Record 4089b47c7ba7ab8015859428e7e6965eec4641e3 does not exist

Caused by: java.io.IOException: org.apache.jackrabbit.core.data.DataStoreException: Record 4089b47c7ba7ab8015859428e7e6965eec4641e3 does not exist


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.  This tool gives you the option to restore index files to the datastore or only rebuild the indexes that are corrupt instead of reindexing all of them as documented here.


Environment

AEM 6.4 / Oak 1.8.8 and later versions

Resolution

  1. Download oak-run jar 1.8.8 or later version to your AEM server.
  2. Run the command below (but swap out the paths to the segmentstore and datastore to match your environment):

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
3. The command would output a datastore consistency check.
4. Using the output, follow the article to restore or fix any missing files.

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:
  1. $ java-jar oak-run-*.jar datastorecheck --id --ref --consistency \
  2. --store | \
  3. --s3ds |--fds \
  4. --dump \
  5. --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.

More like this

Oak DataStore Check

On this page