]> gerrit.simantics Code Review - simantics/platform.git/commit
Improved logic in new head state creation.
authorJussi Koskela <jussi.koskela@semantum.fi>
Tue, 9 May 2017 13:12:17 +0000 (16:12 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 11 May 2017 20:16:49 +0000 (23:16 +0300)
commit7cc6ec281e1c226d2ec47b5bc52b83be3972cc1c
tree7fbddae886ee0f86e70eb62c3090e2717c87b50d
parent4b277ed9a9aeef8bc43794989bd636b3768a4fa2
Improved logic in new head state creation.

Earlier any IOException during the reading of head state was interpreted
as empty DB. This might cause unwanted DB reset. It's better to identify
need for empty head state based on main state head directory.

Switched AcornDatabase.start logic back to using RandomAccessFile for
touching the db/lock file. Using RandomAccessFile instead of
FileSystemProvider.newFileChannel in Windows better prevents any other
process from removing the lock file. The newFileChannel version did not
prevent the user from initially running 'del lock' to remove the file -
although the file will be recreated quickly by the system.

Also AcornDatabase.start now re-throws ProCoreException if
opening/locking the lock-file fails with IOException to prevent the
system from attempting to start up without a proper database to work
with. Previously the system just logged the start-up problem and
continued.

refs #7124

Change-Id: I850b47d8f692e3d1b8ce177b9269540edc4dc272
(cherry picked from commit 25c9cc192b2611646b0a476bf205484500e92997)
bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java
bundles/org.simantics.acorn/src/org/simantics/acorn/HeadState.java
bundles/org.simantics.acorn/src/org/simantics/acorn/MainState.java
bundles/org.simantics.acorn/src/org/simantics/acorn/internal/AcornDatabase.java