簡體   English   中英

如何在Datastax DSE 5.0圖形中提交和回滾圖形操作?

[英]How to commit and rollback graph operations in Datastax DSE 5.0 Graph?

我試着做

DseCluster dseCluster = null;

    try {
        dseCluster = DseCluster.builder()
                .addContactPoint("192.168.1.43")
                .build();
        DseSession dseSession = dseCluster.connect();
        GraphTraversalSource g = DseGraph.traversal(dseSession, new GraphOptions().setGraphName("graph"));
        GraphStatement graphStatement =  DseGraph.statementFromTraversal(g.addV("test"));
        GraphResultSet grs = dseSession.executeGraph(graphStatement.setGraphName("graph"));
        System.out.println(grs.one().asVertex());

        g.tx().commit();

    } finally {
        if (dseCluster != null) dseCluster.close();
    }

因為TitanDB在Datastax收購它之前就允許這樣做,但是我得到“ Graph不支持事務”

Exception in thread "main" java.lang.UnsupportedOperationException: Graph does not support transactions
00:27:52.420 [cluster1-nio-worker-0] DEBUG io.netty.buffer.PoolThreadCache - Freed 26 thread-local buffer(s) from thread: cluster1-nio-worker-0
    at org.apache.tinkerpop.gremlin.structure.Graph$Exceptions.transactionsNotSupported(Graph.java:1127)
    at org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph.tx(EmptyGraph.java:75)
    at org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.tx(GraphTraversalSource.java:320)
    at testbed.TestBed.main(TestBed.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

除了提到Datastax DSE Graph是事務性的以外,我在文檔中什么也找不到。

謝謝!

Michail在Andy回答的另一篇文章中,他提供了有關DSE目前如何進行交易的一些見解。 我們不會直接向最終用戶公開Tinkerpop交易API。 事務當前是隱式的,每個executestatement調用將觸發DSE Graph Server中的Tinkerpop事務機制。 這是一個快速且骯臟的GitHub示例,顯示了事務如何與DSE Graph一起使用-https: //github.com/jlacefie/GraphTransactionExample

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM