问题
i really cant figure out where my problem is. Im using Titan 0.5.0 (It's the same problem with the newer Titan versions...)
I want to load a bunch of vertices and edges from a csv file with 100k entries (each line results in at least 3 nodes and some edges) into my graph. It's taking about 5 minutes to finally complete the import.
So i tried the same with the configuration storage.batch-loading = true.
Well it's significant faster with only 2 minutes to complete the import.
But the problem is, if im turning on the storage.batch-loading = true
option, the nodes and edges are not saved persistent to the database. So if im shutting down Gremlin and reopening my graph, it's empty.
It's working like a charm with the storage.batch-loading
set to false. It takes longer but the entries are saved persistent.
Yes, i'm commiting the Batchgraph after the import and also the graph itself. Am I'm missing something?
In this example i want to import just about 30k nodes for testing, but they are also not saved persistent. Configuration:
storage.backend=berkeleyje
storage.directory=graph
storage.batch-loading = true
query.fast-property = true
Gremlin Script:
g = TitanFactory.open("../graphs/batchImportTest2/batchImportTest2.properties")
//1 Prepare Graph for import
m = g.getManagementSystem();
username = m.makePropertyKey('username').dataType(String.class).make()
m.buildIndex('byUsername',Vertex.class).addKey(username).unique().buildCompositeIndex()
email = m.makePropertyKey('email').dataType(String.class).make()
m.buildIndex('byEmail',Vertex.class).addKey(email).unique().buildCompositeIndex()
m.commit()
g.commit()
//2 Import Nodes and Edges
bg = new BatchGraph(g, VertexIDType.STRING, 50000)
new File("userInfo_js.txt").eachLine({ final String line ->def (username,email) = line.split('\t')*.trim();def userVertex = bg.getVertex(username) ?: bg.addVertex(username); userVertex.setProperty("username", username);userVertex.setProperty("email", email)})
bg.commit()
g.commit()
回答1:
I tried to reproduce it, but it all works as expected. See my Gist for a complete record of my shell session, maybe you can spot a difference:
https://gist.github.com/dkuppitz/5319a2fa7f9a8069fa15
来源:https://stackoverflow.com/questions/28911801/titan-batchloading-berkeleydb-not-persistent