orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

file not found recovering crashed database

Open zerovian opened this issue 12 years ago • 3 comments

orientdb 1.7.0-rc2-snapshot

After an intentional database crash (to test resiliency):

During crash recovery the following gets output:

After the crash recovery the database is missing records. I am testing an upgrade from 1.3 to 1.7

The only changes made were to convert from local to plocal and change index types from OClass.INDEX_TYPE.UNIQUE to OClass.INDEX_TYPE.UNIQUE_HASH_INDEX.

1.3 recovered fine, but 1.7 the result is that various records can no longer be found.

In case this helps this is the schema were are using for the indexes:

String VTYPE_GRAPHDATA = "graphdata"; String IDX_GRAPHDATA_KEY = VTYPE_GRAPHDATA + ".KEY"; String VTYPE_GRAPHROW= "graphrow"; String IDX_GRAPHROW_KEY = VTYPE_GRAPHROW + ".KEY.ROW";

    OSchema schema = db.getMetadata().getSchema();
    schema.createClass(VTYPE_GRAPHROOT);
    OClass dataType = schema.createClass(VTYPE_GRAPHDATA);
    dataType.createProperty("key", OType.STRING);
    dataType.createIndex(IDX_GRAPHDATA_KEY, INDEX_TYPE.UNIQUE_HASH_INDEX, "key");

    OClass rowType = schema.createClass(VTYPE_GRAPHROW);
    rowType.createProperty("key", OType.STRING);
    rowType.createProperty("row", OType.INTEGER);
    rowType.createIndex(IDX_GRAPHROW_KEY, OClass.INDEX_TYPE.NOTUNIQUE, "key");
    rowType.createIndex(IDX_GRAPHROW_KEY_ROW, OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "key", "row");

Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log WARNING: segment file 'database.ocf' was not closed correctly last time Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log WARNING: Storage fathomdatacache was not closed properly. Will try to restore from write ahead log. Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log INFO: Looking for last checkpoint... Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log INFO: FULL checkpoint found. Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log INFO: Data restore procedure from full checkpoint is started. Restore is performed from LSN OLogSequenceNumber{segment=0, position=158486} Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log WARNING: Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OCheckpointEndRecord{lsn=OLogSequenceNumber{segment=0, position=158510}} will be skipped during data restore. Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log INFO: Storage data restore was completed Mar 09, 2014 1:39:24 PM com.orientechnologies.common.log.OLogManager log INFO: Wait till indexes restore after crash was finished. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Index dictionary is not automatic index and will be added as is. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Index dictionary was added in DB index list. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Start creation of index graphrow.KEY Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Index graphrow.KEY was successfully created and rebuild is going to be started. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Rebuild of graphrow.KEY index was successfully finished. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Start creation of index graphrow.KEY.ROW Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log SEVERE: Error during addition of index {type:UNIQUE_HASH_INDEX,algorithm:SBTREE,valueContainerAlgorithm:NONE,name:graphrow.KEY.ROW,indexDefinition:{className:graphrow,indexDefinitions:[2],indClasses:[2],collate:default},indexDefinitionClass:com.orientechnologies.orient.core.index.OCompositeIndexDefinition,clusters:[1],mapRid:#1:4} com.orientechnologies.orient.core.index.OIndexException: Can not delete hash table with name graphrow.KEY.ROW at com.orientechnologies.orient.core.index.hashindex.local.OLocalHashTable.deleteWithoutLoad(OLocalHashTable.java:451) at com.orientechnologies.orient.core.index.engine.OLocalHashTableIndexEngine.deleteWithoutLoad(OLocalHashTableIndexEngine.java:99) at com.orientechnologies.orient.core.index.OIndexAbstract.deleteWithoutIndexLoad(OIndexAbstract.java:705) at com.orientechnologies.orient.core.index.OIndexManagerShared$1.run(OIndexManagerShared.java:414) at java.lang.Thread.run(Thread.java:724) Caused by: java.io.FileNotFoundException: File: C:\OpenEdge\wrk_oemgmt\cachedata\fathomdatacache\null.him at com.orientechnologies.orient.core.storage.fs.OAbstractFile.open(OAbstractFile.java:139) at com.orientechnologies.orient.core.storage.impl.local.OSingleFileSegment.open(OSingleFileSegment.java:53) at com.orientechnologies.orient.core.index.hashindex.local.OLocalHashTable.deleteWithoutLoad(OLocalHashTable.java:435) ... 4 more

Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Start creation of index OUser.name Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Index OUser.name was successfully created and rebuild is going to be started. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Rebuild of OUser.name index was successfully finished. Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Start creation of index ORole.name Mar 09, 2014 1:39:25 PM com.orientechnologies.common.log.OLogManager log INFO: Index ORole.name was successfully created and rebuild is going to be started. Mar 09, 2014 1:39:26 PM com.orientechnologies.common.log.OLogManager log INFO: Rebuild of ORole.name index was successfully finished. Mar 09, 2014 1:39:26 PM com.orientechnologies.common.log.OLogManager log INFO: Start creation of index graphdata.KEY Mar 09, 2014 1:39:26 PM com.orientechnologies.common.log.OLogManager log SEVERE: Error during addition of index {type:UNIQUE_HASH_INDEX,algorithm:SBTREE,valueContainerAlgorithm:NONE,name:graphdata.KEY,indexDefinition:{className:graphdata,field:key,keyType:STRING,collate:default},indexDefinitionClass:com.orientechnologies.orient.core.index.OPropertyIndexDefinition,clusters:[1],mapRid:#1:2} com.orientechnologies.orient.core.index.OIndexException: Can not delete hash table with name graphdata.KEY at com.orientechnologies.orient.core.index.hashindex.local.OLocalHashTable.deleteWithoutLoad(OLocalHashTable.java:451) at com.orientechnologies.orient.core.index.engine.OLocalHashTableIndexEngine.deleteWithoutLoad(OLocalHashTableIndexEngine.java:99) at com.orientechnologies.orient.core.index.OIndexAbstract.deleteWithoutIndexLoad(OIndexAbstract.java:705) at com.orientechnologies.orient.core.index.OIndexManagerShared$1.run(OIndexManagerShared.java:414) at java.lang.Thread.run(Thread.java:724) Caused by: java.io.FileNotFoundException: File: C:\OpenEdge\wrk_oemgmt\cachedata\fathomdatacache\null.him at com.orientechnologies.orient.core.storage.fs.OAbstractFile.open(OAbstractFile.java:139) at com.orientechnologies.orient.core.storage.impl.local.OSingleFileSegment.open(OSingleFileSegment.java:53) at com.orientechnologies.orient.core.index.hashindex.local.OLocalHashTable.deleteWithoutLoad(OLocalHashTable.java:435) ... 4 more

Mar 09, 2014 1:39:26 PM com.orientechnologies.common.log.OLogManager log INFO: 4 indexes were restored successfully, 2 errors Mar 09, 2014 1:39:26 PM com.orientechnologies.common.log.OLogManager log INFO: Indexes restore after crash was finished.

zerovian avatar Mar 09 '14 17:03 zerovian

No issues if I do a clean shutdown. This is reproducable every time. Happens when application is idle (meaning no database write activity; although there may be ongoing reads). I can attach database files if needed from corrupted database. Happens with exact same message with two different embedded databases running in same JVM. Tried with and without JNA + nativeos .jar files. No difference in behavior.

zerovian avatar Mar 09 '14 18:03 zerovian

I think HASH_INDEX aren't crash proof yet, can you try with regular index? Leave OClass.INDEX_TYPE.UNIQUE. Default indexes now are SBTree.

lvca avatar Mar 10 '14 02:03 lvca

Works fine just using UNIQUE. No data loss, and no errors.

zerovian avatar Mar 10 '14 22:03 zerovian