You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

JanusGraph调用getOrCreatePropertyKey时出现时间戳溢出警告

问题
  • 为什么空的JanusGraph无法read messages for timestamp?
  • JanusGraph中janusGraphManagement.getOrCreatePropertyKey()所指的消息是什么?
  • 该警告如何修复,为何添加数据时会大量出现?

触发警告的错误日志:

[WARN] [o.j.d.l.k.KCVSLog.pool-5-thread-1] ::    Could not read messages for timestamp [2023-05-17T12:50:45.282434100Z] (this read will be retried)
java.lang.IllegalArgumentException: Timestamp overflow detected: 2023-05-17T12:50:45.282434100Z

触发问题的关键代码片段:

logger.info("g.V().count().next():\t" + g.V().count().next());
PropertyKey propertyKey = janusGraphManagement.getOrCreatePropertyKey("_id");
复现步骤

操作步骤

  1. 创建并启动Cassandra Docker容器
docker run --name jg-cassandra -d -e CASSANDRA_START_RPC=true -p 9160:9160 -p 9042:9042 -p 7199:7199 -p 7001:7001 -p 7000:7000 cassandra:3.11
  1. 向JanusGraph加载中等规模及以上数据集(指比手动编写的离散测试数据量大的数据集)
  2. 创建并运行指定的Java + Maven项目
  3. 结果
    • 预期:JanusGraph-Cassandra可正常处理消息读取
    • 实际:只要同时存在上述两行代码,无论配置如何,都会持续抛出时间戳溢出警告

已尝试的解决方法

  • 添加数据排查空数据集问题:错误重复次数增加,执行等待时间变长,g.V()相关问题持续存在
  • 创建新Docker容器:问题依旧存在
  • 执行g.V.drop().iterate()清理数据:问题表现无变化
  • 调整getOrCreatePropertyKey()与g.V()的执行顺序:调用getOrCreatePropertyKey()时问题仍会出现
  • 注释getOrCreatePropertyKey(),保留g.V().count().next():问题消失
  • 注释g.V().count().next(),保留getOrCreatePropertyKey():问题消失
  • 重新取消任意一行注释(两行各保留一行):问题再次出现
  • 修改时间戳配置set(TIMESTAMP_PROVIDER.toStringWithoutRoot(), "NANO"):无效果
  • 切换到Java 11(corretto-11 11.0.19):问题依旧存在

完整日志

2023-05-17 07:50:43,822 [INFO] [c.d.o.d.i.c.ContactPoints.main] ::   Contact point localhost:29042 resolves to multiple addresses, will use them all ([localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1])
2023-05-17 07:50:43,930 [INFO] [c.d.o.d.i.c.DefaultMavenCoordinates.main] ::     DataStax Java driver for Apache Cassandra(R) (com.datastax.oss:java-driver-core) version 4.15.0
2023-05-17 07:50:44,444 [INFO] [c.d.o.d.i.c.t.Clock.JanusGraph Session-admin-0] ::   Using native clock for microsecond precision
2023-05-17 07:50:44,725 [WARN] [c.d.o.d.i.c.l.h.OptionalLocalDcHelper.JanusGraph Session-admin-0] ::     [JanusGraph Session|default] You specified datacenter1 as the local DC, but some contact points are from a different DC: Node(endPoint=localhost/[0:0:0:0:0:0:0:1]:29042, hostId=null, hashCode=5aad4393)=null; please provide the correct local DC, or check your contact points
2023-05-17 07:50:44,987 [INFO] [o.j.g.i.UniqueInstanceIdRetriever.main] ::   Generated unique-instance-id=c0a8564916248-rmt-lap-win201
2023-05-17 07:50:45,011 [INFO] [c.d.o.d.i.c.ContactPoints.main] ::   Contact point localhost:29042 resolves to multiple addresses, will use them all ([localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1])
2023-05-17 07:50:45,045 [INFO] [c.d.o.d.i.c.t.Clock.JanusGraph Session-admin-0] ::   Using native clock for microsecond precision
2023-05-17 07:50:45,086 [WARN] [c.d.o.d.i.c.l.h.OptionalLocalDcHelper.JanusGraph Session-admin-0] ::     [JanusGraph Session|default] You specified datacenter1 as the local DC, but some contact points are from a different DC: Node(endPoint=localhost/[0:0:0:0:0:0:0:1]:29042, hostId=null, hashCode=83832b8)=null; please provide the correct local DC, or check your contact points
2023-05-17 07:50:45,112 [INFO] [o.j.d.c.ExecutorServiceBuilder.main] ::  Initiated fixed thread pool of size 40
2023-05-17 07:50:45,254 [INFO] [o.j.g.d.StandardJanusGraph.main] ::  Gremlin script evaluation is disabled
2023-05-17 07:50:45,282 [INFO] [o.j.d.l.k.KCVSLog.main] ::   Loaded unidentified ReadMarker start time 2023-05-17T12:50:45.282434100Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller@48b4a043
2023-05-17 07:50:45,346 [WARN] [o.j.g.t.StandardJanusGraphTx.main] ::    Query requires iterating over all vertices [[]]. For better performance, use indexes
2023-05-17 07:50:45,359 [INFO] [Main.main] ::    g.V().count().next():  0
2023-05-17 07:50:45,393 [WARN] [o.j.d.l.k.KCVSLog.pool-5-thread-1] ::    Could not read messages for timestamp [2023-05-17T12:50:45.282434100Z] (this read will be retried)
java.lang.IllegalArgumentException: Timestamp overflow detected: 2023-05-17T12:50:45.282434100Z
    at org.janusgraph.diskstorage.log.kcvs.KCVSLog.getTimeSlice(KCVSLog.java:393) ~[janusgraph-core-1.0.0-20230504-014643.988c094.jar:?]
    at org.janusgraph.diskstorage.log.kcvs.KCVSLog.access$1500(KCVSLog.java:115) ~[janusgraph-core-1.0.0-20230504-014643.988c094.jar:?]
    at org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller.run(KCVSLog.java:743) [janusgraph-core-1.0.0-20230504-014643.988c094.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]

Process finished with exit code 0

测试代码

public class Test {
    private static final Logger logger = LogManager.getLogger(Main.class);

    public static void main(String[] args) throws InterruptedException, ExecutionException {
        JanusGraph janusGraph = JanusGraphFactory.build()
                .set("storage.backend", "cql")
                .set("storage.hostname", "localhost:29042")
//                .set(TIMESTAMP_PROVIDER.toStringWithoutRoot(), "NANO")
                .open();
        JanusGraphManagement janusGraphManagement = janusGraph.openManagement();
        GraphTraversalSource g = janusGraph.traversal();
        logger.info("g.V().count().next():\t" + g.V().count().next());
//        g.V().limit(10000).drop().iterate();
        PropertyKey propertyKey = janusGraphManagement.getOrCreatePropertyKey("_id");
//        GraphTraversalSource g = janusGraph.traversal();
//        logger.info("g.V().count().next():\t" + g.V().count().next());
        janusGraph.close();
    }
}

环境信息

  • Maven 3.8.1
  • Java 11.0.19(corretto-11)
  • JanusGraph 1.0.0-20230504-014643.988c094
  • Windows 10
  • Docker
  • Cassandra 3.11(Docker容器)

内容的提问来源于stack exchange,提问作者Zach

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 16:42:01