Limit MySQL purgemap deletes

This commit is contained in:
Mike Primm 2022-01-16 21:49:52 -06:00
parent 45299a153c
commit c887df5ad8
1 changed files with 3 additions and 1 deletions

View File

@ -751,7 +751,9 @@ public class MySQLMapStorage extends MapStorage {
c = getConnection();
// Query tiles for given mapkey
Statement stmt = c.createStatement();
stmt.executeUpdate("DELETE FROM " + tableTiles + " WHERE MapID=" + mapkey + ";");
// Limit delete to 1000 at a time (avoid locking whole table)
while (stmt.executeUpdate("DELETE FROM " + tableTiles + " WHERE MapID=" + mapkey + " LIMIT 1000;") > 0) {
}
stmt.close();
} catch (SQLException x) {
Log.severe("Tile purge error - " + x.getMessage());