From: Tuukka Lehtonen Date: Mon, 9 Jan 2017 09:17:02 +0000 (+0200) Subject: Merge "Save cluster sets only when creating DB snapshots" X-Git-Tag: v1.27.0~31 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=d09be9d2b8bf2e982ab7cf5760d39014e7ca4fa1;hp=81169c54002f4a9f89db5b6821f3e5a70dad2da7 Merge "Save cluster sets only when creating DB snapshots" --- 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 c414dd2b6..22629d4e6 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java @@ -147,7 +147,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; } @@ -167,14 +167,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); LOGGER.info(" -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)