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 {
|
try {
|
||||||
c = createConnection();
|
c = createConnection();
|
||||||
closeAllConnections();
|
closeAllConnections();
|
||||||
setDirty(c, false);
|
LOG.info("Compacting DB");
|
||||||
s = c.createStatement();
|
s = c.createStatement();
|
||||||
s.execute("SHUTDOWN COMPACT");
|
s.execute("SHUTDOWN COMPACT");
|
||||||
|
LOG.info("Finished compacting DB");
|
||||||
s.close();
|
s.close();
|
||||||
c.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) {
|
} catch (SQLException e) {
|
||||||
tryToClose(s, LOG, WARNING);
|
tryToClose(s, LOG, WARNING);
|
||||||
tryToClose(c, LOG, WARNING);
|
tryToClose(c, LOG, WARNING);
|
||||||
@@ -126,6 +132,7 @@ class H2Database extends JdbcDatabase {
|
|||||||
closeAllConnections();
|
closeAllConnections();
|
||||||
s = c.createStatement();
|
s = c.createStatement();
|
||||||
s.execute("SHUTDOWN COMPACT");
|
s.execute("SHUTDOWN COMPACT");
|
||||||
|
LOG.info("Finished compacting DB");
|
||||||
s.close();
|
s.close();
|
||||||
c.close();
|
c.close();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user