mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Mark DB as clean after compacting.
This ensures we compact the DB at the next startup if we didn't finish compacting it at shutdown.
This commit is contained in:
@@ -89,11 +89,17 @@ class H2Database extends JdbcDatabase {
|
||||
try {
|
||||
c = createConnection();
|
||||
closeAllConnections();
|
||||
setDirty(c, false);
|
||||
LOG.info("Compacting DB");
|
||||
s = c.createStatement();
|
||||
s.execute("SHUTDOWN COMPACT");
|
||||
LOG.info("Finished compacting DB");
|
||||
s.close();
|
||||
c.close();
|
||||
// Reopen the DB to mark it as clean after compacting
|
||||
c = createConnection();
|
||||
setDirty(c, false);
|
||||
LOG.info("Marked DB as clean");
|
||||
c.close();
|
||||
} catch (SQLException e) {
|
||||
tryToClose(s, LOG, WARNING);
|
||||
tryToClose(c, LOG, WARNING);
|
||||
@@ -126,6 +132,7 @@ class H2Database extends JdbcDatabase {
|
||||
closeAllConnections();
|
||||
s = c.createStatement();
|
||||
s.execute("SHUTDOWN COMPACT");
|
||||
LOG.info("Finished compacting DB");
|
||||
s.close();
|
||||
c.close();
|
||||
} catch (SQLException e) {
|
||||
|
||||
Reference in New Issue
Block a user