The objective here is to find all SegmentNotFoundException type corruption and remove it (as we don't have a valid backup)
Before running any of the below steps we created an index.json file (see the file below) which contains only the index definitions of the corrupted indexes.
- This generates the file indexing-results\index-definities.json
java -Xmx8g -jar oak-run-1.8.12.jar index --fds-path=crx-quickstart\repository\datastore crx-quickstart\repository\segmentstore --index-definitions
- From that file we copied only the definitions we needed and created index.json (file attached here )
Steps to remove corrupt nodes and reindex:
-
Download the oak-run version matching your oak version: https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
-
Upload the file rmCorruptIndexes.groovy to the server
-
Run the oak-run console tool to open a shell:
java -Xmx8g -jar oak-run-1.*.jar console crx-quickstart/repositor/segmentstore --read-write
-
Run this command in the oak-run shell to load the groovy script and delete the bad indexes:
:load rmCorruptIndexes.groovy
-
Remove all checkpoints (to bypass corruption existing between checkpoint revision and head revision of repository)
java -Xmx8g -jar oak-run-1.*.jar checkpoints crx-quickstart/repositor/segmentstore --rm-all
-
Run an offline compaction per these instructions https://gist.github.com/andrewmkhoury/0b1fe4d8b619178ff87b
THIS IS FAILING WITH A SegmentNotFoundException - see here
-
Run the reindex.bat script below to reindex these indexes /oak:index/uuid,/oak:index/repMembers,/oak:index/reference,/oak:index/acPrincipalName,/oak:index/nodetype Note that the last command uses oak-upgrade to copy over the indexing results because the index import feature of the offline indexing tool is failing. The last part of the script opens the oak-run console, we found that this is necessary for AEM to function after the offline indexing.
THIS IS FAILING WITH A SegmentNotFoundException - see here