gentics / mesh-incubator

Project which is home for planned enhancements for Gentics Mesh
3 stars 0 forks source link

Manual Microschema Migration #175

Open deckdom opened 5 years ago

deckdom commented 5 years ago

Gentics Mesh Version, operating system, or hardware.

Problem

As I was using the custom migration script to update a microschema, you have to trigger the migration of the microschemas in a release/branch manually. Apparently there seems to be quite a hick-up with doing so, as it attempts to migrate all microschemas (not only the ones that changed) and sometimes even with wrong versions.

Here're the failing Jobs that were created (some things may be censored):

{
        "uuid": "e981ed180597433181ed180597c33144",
        "creator": {
            "uuid": "184d16c575e144b98d16c575e154b919"
        },
        "created": "2018-11-14T16:16:27Z",
        "errorMessage": "Cannot UPDATE the record #222:9 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v6 your=v5)\r\n\tDB name=\"storage\"",
        "errorDetail": "com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #222:9 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v6 your=v5)\r\n\tDB name=\"storage\"\n\tat com.orientechnologies.orient.core.conflict.OVersionRecordConflictStrategy.checkVersions(OVersionRecordConflictStrategy.java:56)\n\tat com.orientechnologies.orient.core.conflict.OVersionRecordConflictStrategy.onUpdate(OVersionRecordConflictStrategy.java:43)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.checkAndIncrementVersion(OAbstractPaginatedStorage.java:4544)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doUpdateRecord(OAbstractPaginatedStorage.java:4021)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commitEntry(OAbstractPaginatedStorage.java:4606)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:1857)\n\tat com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:541)\n\tat com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:99)\n\tat com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2908)\n\tat com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2870)\n\tat com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.commit(OrientTransactionalGraph.java:182)\n\tat com.syncleus.ferma.ext.orientdb.DelegatingFramedOrientGraph.commit(DelegatingFramedOrientGraph.java:70)\n\tat com.gentics.mesh.core.endpoint.migration.impl.MigrationStatusHandlerImpl.commit(MigrationStatusHandlerImpl.java:58)\n\tat com.gentics.mesh.core.endpoint.migration.micronode.MicronodeMigrationHandler.migrateMicronodes(MicronodeMigrationHandler.java:111)\n\tat com.gentics.mesh.core.data.job.impl.MicronodeMigrationJobImpl.processTask(MicronodeMigrationJobImpl.java:67)\n\tat com.gentics.mesh.core.data.job.impl.JobImpl.process(JobImpl.java:311)\n\tat com.gentics.mesh.core.endpoint.release.ReleaseCrudHandler.lambda$handleMigrateRemainingMicronodes$16(ReleaseCrudHandler.java:252)\n\tat com.syncleus.ferma.tx.TxFactory.lambda$tx$1(TxFactory.java:71)\n\tat com.gentics.mesh.graphdb.OrientDBDatabase.tx(OrientDBDatabase.java:895)\n\tat com.syncleus.ferma.tx.TxFactory.tx(TxFactory.java:70)\n\tat com.gentics.mesh.core.verticle.handler.HandlerUtilities.lambda$asyncTx$15(HandlerUtilities.java:275)\n\tat com.gentics.mesh.core.verticle.handler.HandlerUtilities.lambda$async$17(HandlerUtilities.java:300)\n\tat io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:273)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.lang.Thread.run(Thread.java:748)\n",
        "type": "microschema",
        "status": "FAILED",
        "properties": {
            "fromVersion": "1.0",
            "microschemaName": "my_microschema",
            "releaseName": "dummy",
            "microschemaUuid": "a742a6d315964c2982a6d31596cc2919",
            "releaseUuid": "136730d932a94859a730d932a99859e2",
            "toVersion": "2.0"
        },
        "stopDate": "2018-11-14T16:16:52Z",
        "startDate": "2018-11-14T16:16:37Z",
        "completionCount": 1,
        "nodeName": "Nostalgic Ferrothorn",
        "warnings": []
}
{
        "uuid": "5d5c92cd9db745a39c92cd9db755a3e5",
        "creator": {
            "uuid": "184d16c575e144b98d16c575e154b919"
        },
        "created": "2018-11-14T16:17:14Z",
        "errorMessage": "Cannot UPDATE the record #222:10 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v5 your=v2)\r\n\tDB name=\"storage\"",
        "errorDetail": "com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot UPDATE the record #222:10 because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v5 your=v2)\r\n\tDB name=\"storage\"\n\tat com.orientechnologies.orient.core.conflict.OVersionRecordConflictStrategy.checkVersions(OVersionRecordConflictStrategy.java:56)\n\tat com.orientechnologies.orient.core.conflict.OVersionRecordConflictStrategy.onUpdate(OVersionRecordConflictStrategy.java:43)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.checkAndIncrementVersion(OAbstractPaginatedStorage.java:4544)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doUpdateRecord(OAbstractPaginatedStorage.java:4021)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commitEntry(OAbstractPaginatedStorage.java:4606)\n\tat com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.commit(OAbstractPaginatedStorage.java:1857)\n\tat com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:541)\n\tat com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:99)\n\tat com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2908)\n\tat com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2870)\n\tat com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.commit(OrientTransactionalGraph.java:182)\n\tat com.syncleus.ferma.ext.orientdb.DelegatingFramedOrientGraph.commit(DelegatingFramedOrientGraph.java:70)\n\tat com.gentics.mesh.core.endpoint.migration.impl.MigrationStatusHandlerImpl.commit(MigrationStatusHandlerImpl.java:58)\n\tat com.gentics.mesh.core.endpoint.migration.impl.MigrationStatusHandlerImpl.done(MigrationStatusHandlerImpl.java:96)\n\tat com.gentics.mesh.core.data.job.impl.MicronodeMigrationJobImpl.processTask(MicronodeMigrationJobImpl.java:69)\n\tat com.gentics.mesh.core.data.job.impl.JobImpl.process(JobImpl.java:311)\n\tat com.gentics.mesh.core.endpoint.release.ReleaseCrudHandler.lambda$handleMigrateRemainingMicronodes$16(ReleaseCrudHandler.java:252)\n\tat com.syncleus.ferma.tx.TxFactory.lambda$tx$1(TxFactory.java:71)\n\tat com.gentics.mesh.graphdb.OrientDBDatabase.tx(OrientDBDatabase.java:895)\n\tat com.syncleus.ferma.tx.TxFactory.tx(TxFactory.java:70)\n\tat com.gentics.mesh.core.verticle.handler.HandlerUtilities.lambda$asyncTx$15(HandlerUtilities.java:275)\n\tat com.gentics.mesh.core.verticle.handler.HandlerUtilities.lambda$async$17(HandlerUtilities.java:300)\n\tat io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:273)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.lang.Thread.run(Thread.java:748)\n",
        "type": "microschema",
        "status": "FAILED",
        "properties": {
            "fromVersion": "2.0",
            "microschemaName": "some_other_microschema",
            "releaseName": "dummy",
            "microschemaUuid": "7ac3c3883070406183c3883070f061cc",
            "releaseUuid": "136730d932a94859a730d932a99859e2",
            "toVersion": "4.0"
        },
        "stopDate": "2018-11-14T16:17:32Z",
        "startDate": "2018-11-14T16:17:21Z",
        "completionCount": 0,
        "nodeName": "Nostalgic Ferrothorn",
        "warnings": []
}

In the provided examples, the first one is the microschema I changed. The second one was however not changed, but still spawned a Migration.

Expected behaviour and actual behaviour

It should only create a Job/Migration for actually changed Microschemas and the Job shouldn't fail of an unknown reason.