You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restore of a backup (made with the same OrientDB version) should work without errors.
Actual behavior
There seems to be some sort of race condition between the restore process, which tries to open the database right after restoring the files, and some job, which is scheduled in ViewManager. This sometimes causes the restore process to throw this exception:
com.orientechnologies.orient.core.exception.OStorageException: Storage database is in wrong state MIGRATION and can not be opened.
DB name="database"
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:362)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:334)
at com.orientechnologies.orient.core.storage.disk.OLocalPaginatedStorage.restore(OLocalPaginatedStorage.java:373)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.restore(ODatabaseDocumentEmbedded.java:1863)
Steps to reproduce
I created a JUnit test, which reproduces the error, when used with OrientDB >= 3.2.14.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.FileUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.db.ODatabaseType;
import com.orientechnologies.orient.core.db.OrientDB;
public class BackupRestoreTest {
public final static int repeat = 100;
public final static String basePath = "path";
public final File backupFile = new File(basePath, "backup.zip");
public final static String dbName = "database";
public final static String user = "admin";
public final static String password = "admin";
@BeforeClass
public static void clean() throws IOException {
File baseDir = new File(basePath);
if (baseDir.isDirectory()) {
FileUtils.deleteDirectory(baseDir);
}
}
@Test
public void testBackupRestore() throws IOException {
System.setProperty("security.createDefaultUsers", "true");
try (OrientDB db = new OrientDB("plocal:" + basePath, user, password, null)) {
System.out.println("Creating db");
db.create(dbName, ODatabaseType.PLOCAL);
System.out.println("Creating backup");
backup(db);
for (int i = 0; i < repeat; i++) {
System.out.println(String.format("Restoring backup %d/%d", i + 1, repeat));
restore(db);
}
}
}
protected void backup(OrientDB db) throws IOException {
try (ODatabaseSession session = db.open(dbName, user, password)) {
try (OutputStream out = new FileOutputStream(backupFile)) {
session.backup(out, null, null, null, 1, 2048);
}
}
}
protected void restore(OrientDB db) throws IOException {
try (ODatabaseSession session = db.open(dbName, user, password)) {
try (InputStream in = new FileInputStream(backupFile)) {
session.restore(in, null, null, null);
}
}
}
}
This is the pom.xml with the necessary dependencies:
OrientDB Version: >= 3.2.14
Java Version: OpenJDK 11.0.18-1
OS: Any
Expected behavior
Restore of a backup (made with the same OrientDB version) should work without errors.
Actual behavior
There seems to be some sort of race condition between the restore process, which tries to open the database right after restoring the files, and some job, which is scheduled in ViewManager. This sometimes causes the restore process to throw this exception:
Steps to reproduce
I created a JUnit test, which reproduces the error, when used with OrientDB >= 3.2.14.
This is the pom.xml with the necessary dependencies:
Is there something, that we can change in the restore procedure to overcome this error (e.g. somehow stop that scheduled job from ViewManager)?
The text was updated successfully, but these errors were encountered: