Fix HSQLDB backups.

Change AutoUpdate to use 'quick' backup.

For HSQLDBRepository.backup, don't perform CHECKPOINT DEFRAG while repository in use
as it never completes.

Similarly, use BACKUP DATABASE ... NOT BLOCKING.
This commit is contained in:
catbref 2019-07-04 13:12:25 +01:00
parent 8109214087
commit 9c1ca8de04
2 changed files with 3 additions and 5 deletions

View File

@ -213,7 +213,7 @@ public class AutoUpdate extends Thread {
}
// Give repository a chance to backup in case things go badly wrong
RepositoryManager.backup(false);
RepositoryManager.backup(true);
// Call ApplyUpdate to end this process (unlocking current JAR so it can be replaced)
String javaHome = System.getProperty("java.home");

View File

@ -238,9 +238,7 @@ public class HSQLDBRepository implements Repository {
public void backup(boolean quick) throws DataException {
// First perform a CHECKPOINT
try {
if (quick)
this.connection.createStatement().execute("CHECKPOINT");
else
if (!quick)
this.connection.createStatement().execute("CHECKPOINT DEFRAG");
} catch (SQLException e) {
throw new DataException("Unable to prepare repository for backup");
@ -272,7 +270,7 @@ public class HSQLDBRepository implements Repository {
// Actually create backup
try {
this.connection.createStatement().execute("BACKUP DATABASE TO 'backup/' BLOCKING AS FILES");
this.connection.createStatement().execute("BACKUP DATABASE TO 'backup/' NOT BLOCKING AS FILES");
} catch (SQLException e) {
throw new DataException("Unable to backup repository");
}