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
{{ message }}
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
The ordinal of the enum constant Type1 of com.yq.demo.cell.microstream.enumdemo.MyType would be change by the legacy type mapping from 0 to 1. This may cause the storage becoming corrupted.
#571
Open
yqbjtu opened this issue
May 17, 2023
· 2 comments
When I try to migrate the old microstream database to a new one. it has the following error:
it is easily reproducible or happens intermittently.
To Reproduce
step1, create dataroot, which has a enum member, MyType . store the root in dir1
public enum MyType {
Type1,
Type2,
Type3
}
step2, change the MyType class,
public enum MyType {
Type2,
Type1,
Type3
}
step3, reopen the dir1 and store root again
step4, open the dir1 and dir2(empty dir)
save root1 (from dir1) as root of dir2 and store it
final DataRoot root1 = new DataRoot();
final DataRoot root2 = new DataRoot();
final EmbeddedStorageManager storageManager1 = EmbeddedStorage.start(root1, Paths.get(DATA_DIR1));
final EmbeddedStorageManager storageManager2 = EmbeddedStorage.start(root2, Paths.get(DATA_DIR2));
log.info("start to set root");
storageManager2.setRoot(root1);
storageManager2.storeRoot();
storageManager1.shutdown();
storageManager2.shutdown();
step5, open the dir2
the following error:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
LF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Exception in thread "main" one.microstream.persistence.exceptions.PersistenceExceptionTypeConsistencyEnum: The ordinal of the enum constant Type1 of com.yq.demo.cell.microstream.enumdemo.MyType
would be change by the legacy type mapping from 0 to 1. This may cause the storage becoming corrupted.
If the ordinal change is intended you need to define a manual legacy type mapping!
at one.microstream.persistence.types.PersistenceLegacyTypeHandlerCreator$Abstract.deriveEnumOrdinalMapping(PersistenceLegacyTypeHandlerCreator.java:96)
at one.microstream.persistence.binary.types.BinaryLegacyTypeHandlerCreator$Default.deriveReflectiveHandlerGenericEnum(BinaryLegacyTypeHandlerCreator.java:281)
at one.microstream.persistence.binary.types.BinaryLegacyTypeHandlerCreator$Default.deriveReflectiveHandler(BinaryLegacyTypeHandlerCreator.java:259)
at one.microstream.persistence.binary.types.BinaryLegacyTypeHandlerCreator$Default.deriveReflectiveHandler(BinaryLegacyTypeHandlerCreator.java:64)
at one.microstream.persistence.types.PersistenceLegacyTypeHandlerCreator$Abstract.createLegacyTypeHandler(PersistenceLegacyTypeHandlerCreator.java:140)
at one.microstream.persistence.types.PersistenceLegacyTypeMapper$Default.createLegacyTypeHandler(PersistenceLegacyTypeMapper.java:200)
at one.microstream.persistence.types.PersistenceLegacyTypeMapper$Default.ensureLegacyTypeHandler(PersistenceLegacyTypeMapper.java:400)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureLegacyTypeHandler(PersistenceTypeHandlerManager.java:468)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandler(PersistenceTypeHandlerManager.java:459)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.lambda$ensureTypeHandlers$2(PersistenceTypeHandlerManager.java:493)
at one.microstream.collections.ChainStorageStrong.iterate(ChainStorageStrong.java:1322)
at one.microstream.collections.HashEnum.iterate(HashEnum.java:699)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandlers(PersistenceTypeHandlerManager.java:492)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandlersByTypeIds(PersistenceTypeHandlerManager.java:484)
at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.ensureRequiredTypeHandlers(EmbeddedStorageManager.java:339)
at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:249)
at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:97)
at one.microstream.storage.embedded.types.EmbeddedStorage.createAndStartStorageManager(EmbeddedStorage.java:615)
at one.microstream.storage.embedded.types.EmbeddedStorage.start(EmbeddedStorage.java:472)
at com.yq.demo.cell.microstream.enumdemo.HelloWorld.main(HelloWorld.java:46)
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
At which step did you upgrade the Microstream version?
If done before you changed the enum the simplest solution would restore the original enum class.
If you changed and persisted the enum before upgrading, you may try to apply the mapping as described in #381. If that does not help things get difficult and the example in #432 may be a start.
At which step did you upgrade the Microstream version?
If done before you changed the enum the simplest solution would restore the original enum class. If you changed and persisted the enum before upgrading, you may try to apply the mapping as described in #381. If that does not help things get difficult and the example in #432 may be a start.
in step4, I upgrade the microstream to 8.0 from 7.0. that is when copying the data from dir1 to dir2
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Environment Details
Describe the bug
When I try to migrate the old microstream database to a new one. it has the following error:
it is easily reproducible or happens intermittently.
To Reproduce
step1, create dataroot, which has a enum member, MyType . store the root in dir1
public enum MyType {
Type1,
Type2,
Type3
}
step2, change the MyType class,
public enum MyType {
Type2,
}
step3, reopen the dir1 and store root again
step4, open the dir1 and dir2(empty dir)
save root1 (from dir1) as root of dir2 and store it
step5, open the dir2
the following error:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
LF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Exception in thread "main" one.microstream.persistence.exceptions.PersistenceExceptionTypeConsistencyEnum: The ordinal of the enum constant Type1 of com.yq.demo.cell.microstream.enumdemo.MyType
would be change by the legacy type mapping from 0 to 1. This may cause the storage becoming corrupted.
If the ordinal change is intended you need to define a manual legacy type mapping!
at one.microstream.persistence.types.PersistenceLegacyTypeHandlerCreator$Abstract.deriveEnumOrdinalMapping(PersistenceLegacyTypeHandlerCreator.java:96)
at one.microstream.persistence.binary.types.BinaryLegacyTypeHandlerCreator$Default.deriveReflectiveHandlerGenericEnum(BinaryLegacyTypeHandlerCreator.java:281)
at one.microstream.persistence.binary.types.BinaryLegacyTypeHandlerCreator$Default.deriveReflectiveHandler(BinaryLegacyTypeHandlerCreator.java:259)
at one.microstream.persistence.binary.types.BinaryLegacyTypeHandlerCreator$Default.deriveReflectiveHandler(BinaryLegacyTypeHandlerCreator.java:64)
at one.microstream.persistence.types.PersistenceLegacyTypeHandlerCreator$Abstract.createLegacyTypeHandler(PersistenceLegacyTypeHandlerCreator.java:140)
at one.microstream.persistence.types.PersistenceLegacyTypeMapper$Default.createLegacyTypeHandler(PersistenceLegacyTypeMapper.java:200)
at one.microstream.persistence.types.PersistenceLegacyTypeMapper$Default.ensureLegacyTypeHandler(PersistenceLegacyTypeMapper.java:400)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureLegacyTypeHandler(PersistenceTypeHandlerManager.java:468)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandler(PersistenceTypeHandlerManager.java:459)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.lambda$ensureTypeHandlers$2(PersistenceTypeHandlerManager.java:493)
at one.microstream.collections.ChainStorageStrong.iterate(ChainStorageStrong.java:1322)
at one.microstream.collections.HashEnum.iterate(HashEnum.java:699)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandlers(PersistenceTypeHandlerManager.java:492)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandlersByTypeIds(PersistenceTypeHandlerManager.java:484)
at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.ensureRequiredTypeHandlers(EmbeddedStorageManager.java:339)
at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:249)
at one.microstream.storage.embedded.types.EmbeddedStorageManager$Default.start(EmbeddedStorageManager.java:97)
at one.microstream.storage.embedded.types.EmbeddedStorage.createAndStartStorageManager(EmbeddedStorage.java:615)
at one.microstream.storage.embedded.types.EmbeddedStorage.start(EmbeddedStorage.java:472)
at com.yq.demo.cell.microstream.enumdemo.HelloWorld.main(HelloWorld.java:46)
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: