mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 18:45:21 +01:00
Also remove the cached FK for the map-id when we delete it from the db >_>
This commit is contained in:
parent
1336d26b9f
commit
8af13df3f9
@ -377,35 +377,41 @@ public void deleteMeta(String mapId, String name) throws IOException {
|
||||
|
||||
@Override
|
||||
public void purgeMap(String mapId, Function<ProgressInfo, Boolean> onProgress) throws IOException {
|
||||
try {
|
||||
recoveringConnection(connection -> {
|
||||
executeUpdate(connection,
|
||||
"DELETE t " +
|
||||
"FROM `bluemap_map_tile` t " +
|
||||
" INNER JOIN `bluemap_map` m " +
|
||||
" ON t.`map` = m.`id` " +
|
||||
"WHERE m.`map_id` = ?",
|
||||
mapId
|
||||
);
|
||||
synchronized (mapFKs) {
|
||||
try {
|
||||
recoveringConnection(connection -> {
|
||||
executeUpdate(connection,
|
||||
"DELETE t " +
|
||||
"FROM `bluemap_map_tile` t " +
|
||||
" INNER JOIN `bluemap_map` m " +
|
||||
" ON t.`map` = m.`id` " +
|
||||
"WHERE m.`map_id` = ?",
|
||||
mapId
|
||||
);
|
||||
|
||||
executeUpdate(connection,
|
||||
"DELETE t " +
|
||||
"FROM `bluemap_map_meta` t " +
|
||||
" INNER JOIN `bluemap_map` m " +
|
||||
" ON t.`map` = m.`id` " +
|
||||
"WHERE m.`map_id` = ?",
|
||||
mapId
|
||||
);
|
||||
executeUpdate(connection,
|
||||
"DELETE t " +
|
||||
"FROM `bluemap_map_meta` t " +
|
||||
" INNER JOIN `bluemap_map` m " +
|
||||
" ON t.`map` = m.`id` " +
|
||||
"WHERE m.`map_id` = ?",
|
||||
mapId
|
||||
);
|
||||
|
||||
executeUpdate(connection,
|
||||
"DELETE " +
|
||||
"FROM `bluemap_map` " +
|
||||
"WHERE `map_id` = ?",
|
||||
mapId
|
||||
);
|
||||
}, 2);
|
||||
} catch (SQLException ex) {
|
||||
throw new IOException(ex);
|
||||
|
||||
executeUpdate(connection,
|
||||
"DELETE " +
|
||||
"FROM `bluemap_map` " +
|
||||
"WHERE `map_id` = ?",
|
||||
mapId
|
||||
);
|
||||
}, 2);
|
||||
|
||||
mapFKs.invalidate(mapId);
|
||||
|
||||
} catch (SQLException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -670,7 +676,9 @@ private int getMapTileCompressionFK(Compression compression) throws SQLException
|
||||
}
|
||||
|
||||
private int loadMapFK(String mapId) throws SQLException, IOException {
|
||||
return lookupFK("bluemap_map", "id", "map_id", mapId);
|
||||
synchronized (mapFKs) {
|
||||
return lookupFK("bluemap_map", "id", "map_id", mapId);
|
||||
}
|
||||
}
|
||||
|
||||
private int loadMapTileCompressionFK(Compression compression) throws SQLException, IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user