Fixed WAL checkpointing not running on some systems

This commit is contained in:
Intelli 2022-03-20 16:29:51 -06:00
parent d97f5482ee
commit 92e030f3e8
2 changed files with 10 additions and 1 deletions

View File

@ -73,8 +73,10 @@ public class Process {
return;
}
Consumer.isPaused = true;
Statement statement = connection.createStatement();
Database.performCheckpoint(statement);
Consumer.isPaused = true;
ArrayList<Object[]> consumerData = Consumer.consumer.get(processId);
Map<Integer, String[]> users = Consumer.consumerUsers.get(processId);
Map<Integer, Object> consumerObject = Consumer.consumerObjects.get(processId);

View File

@ -4,6 +4,7 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
@ -88,6 +89,12 @@ public class Database extends Queue {
}
}
public static void performCheckpoint(Statement statement) throws SQLException {
if (!Config.getGlobal().MYSQL) {
statement.executeUpdate("PRAGMA wal_checkpoint(TRUNCATE)");
}
}
public static void setMultiInt(PreparedStatement statement, int value, int count) {
try {
for (int i = 1; i <= count; i++) {