From: Jussi Koskela Date: Thu, 29 Dec 2016 15:54:25 +0000 (+0200) Subject: Save cluster sets only when creating DB snapshots X-Git-Tag: v1.27.0~31^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=72f8e583b6884a32f6731bf6f16cd6470a2b5c06;p=simantics%2Fplatform.git Save cluster sets only when creating DB snapshots Performance improvement. Also fix the order of saving cluster sets and persisting head state. This (luckily) worked correctly earlier as well, since the cluster sets were saved after each change. refs #6904 Change-Id: I67f238f8060672a99160a85bdbd2703d94fa275b --- diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java index b2a30953c..3cbb64977 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java @@ -143,7 +143,7 @@ public class ClusterManager { // Cluster files are always there // Nothing has been written => no need to do anything long amountOfFiles = countFiles(workingDirectory); - if(!fullSave && amountOfFiles < 3) { + if(!fullSave && amountOfFiles == 0) { // System.err.println("amountOfFiles < 3"); return false; } @@ -163,14 +163,14 @@ public class ClusterManager { if (!safeToMakeSnapshot.get()) throw cause; + ClusterSetsSupport cssi = locator.getService(ClusterSetsSupport.class); + cssi.save(); + persistHeadState(); - + if (fullSave) mainState.save(dbFolder); - ClusterSetsSupport cssi = locator.getService(ClusterSetsSupport.class); - cssi.save(); - amountOfFiles = countFiles(workingDirectory); System.err.println(" -finished: amount of files is " + amountOfFiles); diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/TransactionToken.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/TransactionToken.java index 753023641..d5f5c4308 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/TransactionToken.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/TransactionToken.java @@ -213,12 +213,6 @@ public class TransactionToken implements GraphSession.Listener { else if (Type.Read == type) throw new ValidationException("Illegal transaction type."); // Note that even if we do cancel the cluster sets are not restored. - try { - session.getService(ClusterSetsSupport.class).save(); - } catch (Exception e) { - e.printStackTrace(); - Logger.defaultLogError("Failed to save cluster sets.", e); - } graphSession.undoContext.cancelCommit(); endTransaction(true); if (DEBUG)