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,6 +377,7 @@ public class SQLStorage extends Storage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void purgeMap(String mapId, Function<ProgressInfo, Boolean> onProgress) throws IOException {
|
public void purgeMap(String mapId, Function<ProgressInfo, Boolean> onProgress) throws IOException {
|
||||||
|
synchronized (mapFKs) {
|
||||||
try {
|
try {
|
||||||
recoveringConnection(connection -> {
|
recoveringConnection(connection -> {
|
||||||
executeUpdate(connection,
|
executeUpdate(connection,
|
||||||
|
@ -397,6 +398,7 @@ public class SQLStorage extends Storage {
|
||||||
mapId
|
mapId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
executeUpdate(connection,
|
executeUpdate(connection,
|
||||||
"DELETE " +
|
"DELETE " +
|
||||||
"FROM `bluemap_map` " +
|
"FROM `bluemap_map` " +
|
||||||
|
@ -404,10 +406,14 @@ public class SQLStorage extends Storage {
|
||||||
mapId
|
mapId
|
||||||
);
|
);
|
||||||
}, 2);
|
}, 2);
|
||||||
|
|
||||||
|
mapFKs.invalidate(mapId);
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
throw new IOException(ex);
|
throw new IOException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> collectMapIds() throws IOException {
|
public Collection<String> collectMapIds() throws IOException {
|
||||||
|
@ -670,8 +676,10 @@ public class SQLStorage extends Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int loadMapFK(String mapId) throws SQLException, IOException {
|
private int loadMapFK(String mapId) throws SQLException, IOException {
|
||||||
|
synchronized (mapFKs) {
|
||||||
return lookupFK("bluemap_map", "id", "map_id", mapId);
|
return lookupFK("bluemap_map", "id", "map_id", mapId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int loadMapTileCompressionFK(Compression compression) throws SQLException, IOException {
|
private int loadMapTileCompressionFK(Compression compression) throws SQLException, IOException {
|
||||||
return lookupFK("bluemap_map_tile_compression", "id", "compression", compression.getTypeId());
|
return lookupFK("bluemap_map_tile_compression", "id", "compression", compression.getTypeId());
|
||||||
|
|
Loading…
Reference in New Issue