mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-02 14:37:45 +01:00
DB Clean now takes server UUID into account
Affects issues: - Fixed #1341
This commit is contained in:
parent
aef0aa5447
commit
62f3f46678
@ -19,6 +19,7 @@ package com.djrapitops.plan.storage.database.transactions.init;
|
|||||||
import com.djrapitops.plan.delivery.domain.DateObj;
|
import com.djrapitops.plan.delivery.domain.DateObj;
|
||||||
import com.djrapitops.plan.storage.database.queries.objects.TPSQueries;
|
import com.djrapitops.plan.storage.database.queries.objects.TPSQueries;
|
||||||
import com.djrapitops.plan.storage.database.sql.tables.PingTable;
|
import com.djrapitops.plan.storage.database.sql.tables.PingTable;
|
||||||
|
import com.djrapitops.plan.storage.database.sql.tables.ServerTable;
|
||||||
import com.djrapitops.plan.storage.database.sql.tables.TPSTable;
|
import com.djrapitops.plan.storage.database.sql.tables.TPSTable;
|
||||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||||
@ -62,27 +63,31 @@ public class RemoveOldSampledDataTransaction extends ThrowawayTransaction {
|
|||||||
|
|
||||||
private Executable cleanTPSTable(int allTimePlayerPeak) {
|
private Executable cleanTPSTable(int allTimePlayerPeak) {
|
||||||
String sql = DELETE_FROM + TPSTable.TABLE_NAME +
|
String sql = DELETE_FROM + TPSTable.TABLE_NAME +
|
||||||
WHERE + '(' + TPSTable.DATE + "<?)" +
|
WHERE + TPSTable.DATE + "<?" +
|
||||||
AND + '(' + TPSTable.PLAYERS_ONLINE + "!=?)";
|
AND + TPSTable.PLAYERS_ONLINE + "!=?" +
|
||||||
|
AND + TPSTable.SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID;
|
||||||
|
|
||||||
return new ExecStatement(sql) {
|
return new ExecStatement(sql) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(PreparedStatement statement) throws SQLException {
|
public void prepare(PreparedStatement statement) throws SQLException {
|
||||||
statement.setLong(1, System.currentTimeMillis() - deleteTPSOlderThanMs);
|
statement.setLong(1, System.currentTimeMillis() - deleteTPSOlderThanMs);
|
||||||
statement.setInt(2, allTimePlayerPeak);
|
statement.setInt(2, allTimePlayerPeak);
|
||||||
|
statement.setString(3, serverUUID.toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Executable cleanPingTable() {
|
private Executable cleanPingTable() {
|
||||||
String sql = DELETE_FROM + PingTable.TABLE_NAME +
|
String sql = DELETE_FROM + PingTable.TABLE_NAME +
|
||||||
WHERE + '(' + PingTable.DATE + "<?)" +
|
WHERE + '(' + PingTable.DATE + "<?" +
|
||||||
OR + '(' + PingTable.MIN_PING + "<0)";
|
AND + PingTable.SERVER_UUID + "=?)" +
|
||||||
|
OR + PingTable.MIN_PING + "<0";
|
||||||
|
|
||||||
return new ExecStatement(sql) {
|
return new ExecStatement(sql) {
|
||||||
@Override
|
@Override
|
||||||
public void prepare(PreparedStatement statement) throws SQLException {
|
public void prepare(PreparedStatement statement) throws SQLException {
|
||||||
statement.setLong(1, System.currentTimeMillis() - deletePingOlderThanMs);
|
statement.setLong(1, System.currentTimeMillis() - deletePingOlderThanMs);
|
||||||
|
statement.setString(2, serverUUID.toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user