Skip to content

Instantly share code, notes, and snippets.

@marcelmaatkamp
Last active March 26, 2024 10:13
Show Gist options
  • Save marcelmaatkamp/123e8793e07a72a382d8d0e8d66bbd8f to your computer and use it in GitHub Desktop.
Save marcelmaatkamp/123e8793e07a72a382d8d0e8d66bbd8f to your computer and use it in GitHub Desktop.
Fix Sonatype Nexus OrientDB
$ ls /opt/sonatype/sonatype-work/nexus3/db/
OSystem accesslog analytics audit component config model.properties security
$ docker-compose exec nexus java -jar ./lib/support/nexus-orient-console.jar
CONNECT PLOCAL:/opt/sonatype/sonatype-work/nexus3/db/component admin admin
REBUILD INDEX *
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
DISCONNECT
@SilentTalentsSolutions
Copy link

Another note about this: With nexus OSS 3.15.1, when it ran out of disk space, it created WAL files with zero file size. These caused orientdb to croak with null pointer exceptions on startup. I just had to remove the zero size files, and then the above commands worked perfectly.

Many thanks

@microyahoo
Copy link

~/go/src/etcd-io/etcd/tools/etcd-dump-db (main ✔) docker exec -u 0 -ti af9b0952e351 bash
                              
[root@af9b0952e351 /]# java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar 
                                                                      
OrientDB console v.2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x) https://www.orientdb.com
Type 'help' to display all the supported commands.    
orientdb> CONNECT PLOCAL:/opt/sonatype/sonatype-work/nexus3/db/component admin admin
                                   
Connecting to database [PLOCAL:/opt/sonatype/sonatype-work/nexus3/db/component] with user 'admin'...
2023-08-21 08:11:10:770 WARNI {db=component} Storage 'component' was not closed properly. Will try to recover from write ahead log... [OLocalPaginatedStorage]                                                     
2023-08-21 08:11:10:779 WARNI {db=component} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRec
ord{lsn=LSN{segment=23, position=160518}} will be skipped during data restore [OLocalPaginatedStorage]
2023-08-21 08:11:10:779 WARNI {db=component} Record OFuzzyCheckpointStartRecord{lsn=LSN{segment=23, position=160525}} com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointStartRecord{lsn=null,previousCheckpoint=LSN{segment=23, position=160478}} will be skipped during data restore [OLocalPaginatedStorage]
2023-08-21 08:11:10:780 WARNI {db=component} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRecord{lsn=LSN{segment=23, position=160565}} will be skipped during data restore [OLocalPaginatedStorage]OK
orientdb {db=component}> REBUILD INDEX *        
                                   

Rebuilding index(es)...
Rebuilt index(es). Found 108 link(s) in 10.375000 sec(s).

Index(es) rebuilt successfully
orientdb {db=component}> REPAIR DATABASE --fix-graph

Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors) 
orientdb {db=component}> REPAIR DATABASE --fix-links

Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors) 
orientdb {db=component}> 
orientdb {db=component}> REPAIR DATABASE --fix-ridbags

Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors) 
orientdb {db=component}> REPAIR DATABASE --fix-bonsai 

Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors) 
orientdb {db=component}> disconnect  

Disconnecting from the database [component]...OK
orientdb>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment