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=-c Merge "Save cluster sets only when creating DB snapshots" --- d09be9d2b8bf2e982ab7cf5760d39014e7ca4fa1 diff --combined bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java index c414dd2b6,3cbb64977..22629d4e6 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java @@@ -35,12 -35,8 +35,12 @@@ import org.simantics.db.service.Cluster import org.simantics.db.service.ClusterUID; import org.simantics.utils.threads.logger.ITask; import org.simantics.utils.threads.logger.ThreadLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ClusterManager { + + final static Logger LOGGER = LoggerFactory.getLogger(ClusterManager.class); private ArrayList currentChanges = new ArrayList(); @@@ -147,12 -143,12 +147,12 @@@ // 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; } - System.err.println("makeSnapshot"); + LOGGER.info("makeSnapshot"); // Schedule writing of all data to disk refreshHeadState(); @@@ -167,17 -163,17 +167,17 @@@ 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); + LOGGER.info(" -finished: amount of files is {}", amountOfFiles); workingDirectory = dbFolder.resolve(Integer.toString(mainState.headDir)); if (!Files.exists(workingDirectory)) {