OrientDB corruption state in Nexus Repository version 3.2.0-01

為{幸葍}努か 提交于 2019-12-02 21:49:45
Eugen Mayer

Just in case that actually matters for somebody else - the above did not help me, but the json export / import one.

In my case nexus runs in the official docker image, so

docker exec -it nexus bash

Or however you access your nexus shell

cd /tmp
/opt/jdk1.8.0_141/bin/java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar

CONNECT plocal:/nexus-data/db/component admin admin

export database component-export
drop database
create database plocal:/nexus-data/db/component
import database component-export.json.gz

In your case the java-path could vary as also the data-path (nexus data) which we use to connect/create the database.

After that, restarting the service and your component database should be up and running again

We had similar issue with Nexus OSS verison 3.2.0-01 and OrientDB corrupted state because of unclean shutdown.

In our case the coruppted storage was component located in

$install-dir/sonatype-work/nexus3/db/component

2017-04-14 15:09:20,007+0200 ERROR [qtp18266400-74] *UNKNOWN com.google.common.eventbus.EventBus.reentrant - Could not dispatch event AssetUpdatedEvent{metadata=AttachedEntityMetadata{schema=asset, document=asset#18:91856{bucket:#13:3,format:maven2,last_updated:Fri Apr 14 15:09:19 CEST 2017,attributes:[5],component:null,name:org/apache/maven/plugins/maven-jar-plugin/maven-metadata.xml,size:743,content_type:application/xml,blob_ref:default@ECF4439E-D7F184F8-578BAB14-ACFC0FB8-5589B163:3fb95745-4aed-460f-b711-b5f5b74b837c,last_accessed:Fri Apr 14 15:09:19 CEST 2017} v466}, remoteNodeId=null} to subscriber org.sonatype.nexus.repository.maven.internal.group.MavenGroupFacet$$EnhancerByGuice$$a88d7327@83eca7 method [public void org.sonatype.nexus.repository.maven.internal.group.MavenGroupFacet.on(org.sonatype.nexus.repository.storage.AssetEvent)]
com.orientechnologies.orient.core.exception.OStorageException: Error during transaction commit
        DB name="component"
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.makeRollback(OAbstractPaginatedStorage.java:2210) [na:na]
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:1433) [na:na]
        at com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:539) [com.orientechnologies.orientdb-core:2.2.13]
        at com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:104) [com.orientechnologies.orientdb-core:2.2.13]
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2756) [com.orientechnologies.orientdb-core:2.2.13]
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2725) [com.orientechnologies.orientdb-core:2.2.13]
        at org.sonatype.nexus.repository.storage.StorageTxImpl.commit(StorageTxImpl.java:172) [org.sonatype.nexus.repository:3.2.0.01]
        at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source) [na:na]

We managed to solve our problem with the following strategy

  1. Scheduling Nexus tasks, particullary:

    • Rebuild Maven repository metadata.
    • Rebuild repository index.
    • Compact blob store.
  2. Orient DB manipulation:

    • Rebuilding indexes.
    • Repairing database.

According Nexus support you can access Orient DB console with Nexus OSS verison 3.2.1-01. Everything is explained here. Make sure your Nexus application is properly shut down before you apply any operations on database.

Once in Orient DB console you connect to local database with

> CONNECT PLOCAL:${your_install_dir}/sonatype-work/nexus3/db/${database} admin admin

And you perform the following operations:

> REBUILD INDEX *
> REPAIR DATABASE --fix-graph
> REPAIR DATABASE --fix-links
> REPAIR DATABASE --fix-ridbags
> REPAIR DATABASE --fix-bonsai
> DISCONNECT

I am absolutely aware my answer probably won't solve your concrete problem but I still wanted to give you some directions because you don't have any backups.

vinay

The database write ahead logs are corrupt.

Make a backup of $install-dir/sonatype-work/nexus3/db/component, and then remove files with extension .wal from that directory. Then try the startup again

if the issue still persist, try clearing all .wal files under the "DB" directory, will resolve the issue,

I did tried this method and it worked like charm.

regards vinay

With Nexus 3.16 there is now a task: Create Repair - Reconcile component database from blob store

super slow, but it helps recreating a accidentally deleted blobstore still on disk.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!