0

I'm having trouble restoring an OrientDB database from a backup. I'm using OrientDB version 1.2.0 (this backup is from November 2012) and the backup was produced by OrientDB (same version) using the built-in backup utility. I'm trying to restore the backup to a new database using the OrientDB console:

create database remote:localhost/dbname root password local graph
import database backup.json

But when I run those commands, I get the following error in the console:

Importing indexes ...
- Index 'dictionary'...Error on database import happened just before line 22258, column 6
com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot update record #0:1 in storage 'dbname' because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v2 your=v1)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:429)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:382)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:145)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:59)
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1556)
    at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:727)
    at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:191)
    at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:60)
    at com.orientechnologies.orient.core.index.OIndexManagerRemote.dropIndex(OIndexManagerRemote.java:80)
    at com.orientechnologies.orient.core.index.OIndexManagerProxy.dropIndex(OIndexManagerProxy.java:80)
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importIndexes(ODatabaseImport.java:687)
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:127)
    at com.orientechnologies.orient.console.OConsoleDatabaseApp.importDatabase(OConsoleDatabaseApp.java:1419)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.orientechnologies.common.console.OConsoleApplication.execute(OConsoleApplication.java:238)
    at com.orientechnologies.common.console.OConsoleApplication.executeCommands(OConsoleApplication.java:127)
    at com.orientechnologies.common.console.OConsoleApplication.run(OConsoleApplication.java:92)
    at com.orientechnologies.orient.console.OConsoleDatabaseApp.main(OConsoleDatabaseApp.java:130)

All of the records import correctly, but it fails on the indexes. I have 15+ backups of the same database and they all have this issue, so it seems unlikely that they're all corrupted. How can I restore my database? (I'm OK with having to modify the JSON if needbe.)


When trying to use local mode rather than remote mode, I get a different error:

Started import of database 'local:dbname' from dbname.json...
Importing database info...OK
Importing clusters...
- Creating cluster 'internal'...OK, assigned id=0
- Creating cluster 'default'...Error on database import happened just before line 13, column 52
com.orientechnologies.orient.core.exception.OConfigurationException: Imported cluster 'default' has id=3 different from the original: 2. To continue the import drop the cluster 'manindex' that has 1 records
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importClusters(ODatabaseImport.java:544)
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:130)
    at com.orientechnologies.orient.console.OConsoleDatabaseApp.importDatabase(OConsoleDatabaseApp.java:1414)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.orientechnologies.common.console.OConsoleApplication.execute(OConsoleApplication.java:269)
    at com.orientechnologies.common.console.OConsoleApplication.executeCommands(OConsoleApplication.java:157)
    at com.orientechnologies.common.console.OConsoleApplication.run(OConsoleApplication.java:97)
    at com.orientechnologies.orient.graph.console.OGremlinConsole.main(OGremlinConsole.java:53)

Error: com.orientechnologies.orient.core.db.tool.ODatabaseExportException: Error on importing database 'dbname' from file: dbname.json
Error: com.orientechnologies.orient.core.exception.OConfigurationException: Imported cluster 'default' has id=3 different from the original: 2. To continue the import drop the cluster 'manindex' that has 1 records

It seems like the issue is that my old cluster IDs don't match the ones in the new database. Perhaps there are creation options that affect which clusters are created by default?

3
  • in which version of OrientDB you are trying to import the export?
    – wolf4ood
    Sep 18, 2015 at 6:32
  • Try re-importing the database using plocal, not remote. So stop the server and create a database on your local directory.
    – Lvca
    Sep 18, 2015 at 8:00
  • Sorry, I should have made that more clear: I'm using version 1.2.0 to import the backup (same version that created the backup). @Lvca, I tried using local mode and got a slightly different error that I've added to the question.
    – GJK
    Sep 18, 2015 at 8:51

1 Answer 1

0

It turns out that the issue was that the database was being imported with OrientDB version 1.2.0 but was created with 1.0.1 (or 1.0.0). The JSON file listed version 1.2.0 as the engine-version, but that was the engine that backed it up, not created it. After I tried Lvca's suggestion of using local mode, I discovered that the cluster IDs weren't matching up. From there I guessed that the version numbers might not be correct. So it seems that even though I was running the database using the 1.2.0 server and the 1.2.0 Java library, the database was never "upgraded" to use the new 1.2.0 schema.

Thanks to Lvca for a nudge in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.