SparkseeConfig conf = new SparkseeConfig();
Sparksee sparksee;
Database db;
Session sparksee_session;
Graph sparksee_graph;
public void createDB(dbname) {
sparksee = new Sparksee(conf); dbfilename = dbname + ".dex"; db = sparksee.create(dbfilename, dbname); this.defineSchema(); // define nodes and attributes }
public boolean openTransaction() {
try {
sparksee_session = db.newSession();
sparksee_session.begin();
sparksee_graph = sparksee_session.getGraph();
return true;
} catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
public boolean closeTransaction() { try { sparksee_session.commit(); sparksee_session.close(); sparksee_session.delete(); return true; } catch (Exception e) { System.out.println(e.getMessage()); return false; } }
long inserted = 0;
for (Data data : mydata) { // 1M of nodes
long node = sparksee_graph.newNode(person);
sparksee_graph.setAttribute(node, ...);
// others basic operations here
inserted++;
if (inserted >= 1000){
this.closeTransaction(); this.openTransaction(); insertions = 0; }
}
Hi,
You'll have to enable first the recovery system, like this:
SparkseeConfig conf = new SparkseeConfig();
conf.setRecoveryEnabled(true);
Check more information about the recovery here.
Commits should then make grow your main database file and/or the recovery log.
Lowering the CacheMaxSize makes the database file grow because not all the information fits in memory anymore. But since your data is not safe without recovery, we recommend enabling it although it may have a small performance penalty and not lowering CacheMaxSize too much.