]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Save cluster sets only when creating DB snapshots"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 9 Jan 2017 09:17:02 +0000 (11:17 +0200)
committerGerrit Code Review <gerrit2@www.simantics.org>
Mon, 9 Jan 2017 09:17:02 +0000 (11:17 +0200)
bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java
bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/TransactionToken.java

index c414dd2b601a834a1de15d55be218535721b349d..22629d4e64237ab63c6fc89a12f0754087254edb 100644 (file)
@@ -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);
index 753023641197617f87419e361e1f976f2f34688f..d5f5c4308903cdd6aee7d0a5c3dbed5ffe1f40a2 100644 (file)
@@ -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)