Janusgraph JanusGraphException Could not commit transaction due to exception during persistence 无法提交事务

Janusgraph JanusGraphException Could not commit transaction due to exception during persistence

我得到了 janusgraph 0.4.0

apache.tinkerpop.gremlin 3.4.2

com.github.jespersm.spring-data-gremlin 1.0.0-SNAPSHOT

和寡妇 10

然后我尝试运行这样的测试

    Graph graph = JanusGraphFactory.open("inmemory");
    graph.traversal()
         .addV("Org").iterate();

    graph.traversal().tx().commit();

仅此而已

当我 运行 这个测试(或任何 JanusGraphFactory.open 和 tx().commit() 之后的测试), 我得到这个例外

    [2019-11-18 16:50:56,774]  INFO builder.ReadConfigurationBuilder: Set default timestamp provider MICRO
    [2019-11-18 16:50:56,790]  INFO idmanagement.UniqueInstanceIdRetriever: Generated unique-instance-id=c0a8014f15872-DESKTOP-DQPEHPP1
    [2019-11-18 16:50:56,801]  INFO diskstorage.Backend: Initiated backend operations thread pool of size 24
    [2019-11-18 16:50:56,875]  INFO kcvs.KCVSLog: Loaded unidentified ReadMarker start time 2019-11-18T13:50:56.873113Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller@6a0659ac
    [2019-11-18 16:50:57,197]  WARN consistentkey.ConsistentKeyLocker: Skipping outdated lock on KeyColumn [k=0x 16-165-160-118-108- 30- 80-101-114-115-111-238, c=0x  0] with our rid ( 99- 48- 97- 56- 48- 49- 52-102- 49- 53- 56- 55- 50- 45- 68- 69- 83- 75- 84- 79- 80- 45- 68- 81- 80- 69- 72- 80- 80- 49) but mismatched timestamp (actual ts 2019-11-18T13:50:57.094518Z, expected ts 2019-11-18T13:50:57.094518800Z)
    [2019-11-18 16:50:57,198] ERROR database.StandardJanusGraph: Could not commit transaction [1] due to storage exception in system-commit
    org.janusgraph.core.JanusGraphException: Could not execute operation due to backend exception

    org.janusgraph.core.JanusGraphException: Could not commit transaction due to exception during persistence

        at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.commit(StandardJanusGraphTx.java:1475)
        at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph$GraphTransaction.doCommit(JanusGraphBlueprintsGraph.java:297)
        at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.commit(AbstractTransaction.java:104)
        at factograph.core.project.cypher.CypherTransformerTest.someError(CypherTransformerTest.java:159)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58)
        at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    Caused by: org.janusgraph.core.JanusGraphException: Could not execute operation due to backend exception
        at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:56)
        at org.janusgraph.diskstorage.keycolumnvalue.cache.CacheTransaction.persist(CacheTransaction.java:91)
        at org.janusgraph.diskstorage.keycolumnvalue.cache.CacheTransaction.flushInternal(CacheTransaction.java:139)
        at org.janusgraph.diskstorage.keycolumnvalue.cache.CacheTransaction.commit(CacheTransaction.java:196)
        at org.janusgraph.diskstorage.BackendTransaction.commit(BackendTransaction.java:150)
        at org.janusgraph.graphdb.database.StandardJanusGraph.commit(StandardJanusGraph.java:717)
        at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.commit(StandardJanusGraphTx.java:1464)
        ... 25 more
    Caused by: org.janusgraph.diskstorage.locking.PermanentLockingException: Permanent locking failure
        at org.janusgraph.diskstorage.locking.AbstractLocker.checkLocks(AbstractLocker.java:359)
        at org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingTransaction.checkAllLocks(ExpectedValueCheckingTransaction.java:175)
        at org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingTransaction.prepareForMutations(ExpectedValueCheckingTransaction.java:154)
        at org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingStoreManager.mutateMany(ExpectedValueCheckingStoreManager.java:72)
        at org.janusgraph.diskstorage.keycolumnvalue.cache.CacheTransaction.call(CacheTransaction.java:94)
        at org.janusgraph.diskstorage.keycolumnvalue.cache.CacheTransaction.call(CacheTransaction.java:91)
        at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:68)
        at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:54)
        ... 31 more
    Caused by: org.janusgraph.diskstorage.PermanentBackendException: Read 1 locks with our rid  99- 48- 97- 56- 48- 49- 52-102- 49- 53- 56- 55- 50- 45- 68- 69- 83- 75- 84- 79- 80- 45- 68- 81- 80- 69- 72- 80- 80- 49 but mismatched timestamps; no lock column contained our timestamp (2019-11-18T13:50:57.094518800Z)
        at org.janusgraph.diskstorage.locking.consistentkey.ConsistentKeyLocker.checkSeniority(ConsistentKeyLocker.java:528)
        at org.janusgraph.diskstorage.locking.consistentkey.ConsistentKeyLocker.checkSingleLock(ConsistentKeyLocker.java:454)
        at org.janusgraph.diskstorage.locking.consistentkey.ConsistentKeyLocker.checkSingleLock(ConsistentKeyLocker.java:118)
        at org.janusgraph.diskstorage.locking.AbstractLocker.checkLocks(AbstractLocker.java:351)
        ... 38 more

我正在尝试一切!

  1. 删除所有 m2 文件夹并 mvn clean + 重新导入,但这没有帮助
  2. 由管理员重新加载想法并清理想法 chache
  3. 我尝试 运行 'bin/JanusGraph.sh clean',但这确实有帮助
  4. 删除所有本地 gremlin 和 janusgraph 目录,然后重新加载它们
  5. 在 Whosebug JanusGraphException: Could not execute operation due to backend exception 上发现了一点提及,但无法理解这个解决方案中发生了什么,作者提到的 "zip" 是什么以及它如何帮助他

请问有知道答案的吗???

这是一个非常奇怪的问题...

最后,我找到了不好的解决方案,但它有效

1) 我猜问题只出在 Windows 10 上(我的 windows 10 同事也不能 运行 janusgraph localy),图形配置中的时间戳有一些差异,因为在堆栈跟踪中您可以看到消息:

    no lock column contained our timestamp (2019-11-18T13:50:57.094518800Z)

linux 和 Windows 的唯一区别是 Linux 时间以毫秒为单位,而 Windows 时间以纳秒为单位

但是我无法更改此设置,也许你知道如何,如果你知道请告诉我!!

2) 至 运行 本地我从

更改
    graph = JanusGraphFactory.open("inmemory");

    String dir = "c:\opt\graph";
    CommonsConfiguration config = new CommonsConfiguration();
    config.set(STORAGE_BACKEND.toStringWithoutRoot(), "berkeleyje");
    config.set(STORAGE_DIRECTORY.toStringWithoutRoot(), dir);
    config.set(ALLOW_UPGRADE.toStringWithoutRoot(), false);
    config.set(LOCK_MODE.toStringWithoutRoot(), LockMode.READ_UNCOMMITTED.toString());
    config.set(JVM_CACHE.toStringWithoutRoot(), "50");

    graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(config));

而且有效

但这是一个糟糕的解决方案

反正我不知道哪个更好

我 运行 遇到了类似的问题,看起来可以在配置文件中设置配置选项 graph.timestamps。

如果您要创建如下图形:

Configuration conf = new PropertiesConfiguration(propertiesFileName);
Graph graph = GraphFactory.open(conf);

在 propertiesFileName 引用的文件中,您可以这样设置配置选项:

graph.timestamps=NANO

这解决了我在 Windows 上的问题。

我能够使用以下内容实例化内存中的图形:

JanusGraph graph = JanusGraphFactory.build()
    .set(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory")
    .set(TIMESTAMP_PROVIDER.toStringWithoutRoot(), "NANO")
    .open();

更多信息请点击此处 https://github.com/JanusGraph/janusgraph/issues/1979。下个版本会修复