fix(glue): serialize table deletion with catalog updates (#8173)

This commit is contained in:
Jackson Price authored and GitHub committed 2026-11-12 22:17:43 -04:00
1 parent 7c138ce3f1
commit 405a3cad12
4 files changed
+253 -14

No files matched your search

@@ -85,6 +85,7 @@ public class GlueService {
private static final Logger LOG = Logger.getLogger(GlueService.class);
private static final int MAX_FUNCTION_PATTERN_LENGTH = 255;
private static final int MAX_FUNCTION_RESULTS = 100;
private static final int MAX_BATCH_DELETE_TABLES = 100;
private static final int MAX_SECURITY_CONFIGURATION_NAME_LENGTH = 255;
private static final int MAX_DATA_QUALITY_NAME_LENGTH = 255;
private static final int MAX_DATA_QUALITY_DESCRIPTION_LENGTH = 2048;
@@ -790,7 +791,7 @@ public class GlueService {
}
}
public void deleteTable(String databaseName, String tableName) {
public synchronized void deleteTable(String databaseName, String tableName) {
getTable(databaseName, tableName);
String key = tableKey(databaseName, tableName);
tableStore.delete(key);
@@ -813,20 +814,27 @@ public class GlueService {
}
public List<BatchDeleteTableError> batchDeleteTables(String databaseName, List<String> tableNames) {
getDatabase(databaseName);
List<BatchDeleteTableError> errors = new ArrayList<>();
for (String tableName : tableNames) {
String key = tableKey(databaseName, tableName);
Optional<Table> table = tableStore.get(key);
if (table.isEmpty()) {
errors.add(new BatchDeleteTableError(
tableName,
new ErrorDetail("EntityNotFoundException", "Table " + tableName + " not found")));
continue;
}
deleteTable(databaseName, tableName);
validateRequired(tableNames, "TablesToDelete");
if (tableNames.size() > MAX_BATCH_DELETE_TABLES) {
throw new AwsException("InvalidInputException",
"TablesToDelete must have at most " + MAX_BATCH_DELETE_TABLES + " items.", 400);
}
synchronized (this) {
getDatabase(databaseName);
List<BatchDeleteTableError> errors = new ArrayList<>();
for (String tableName : tableNames) {
String key = tableKey(databaseName, tableName);
Optional<Table> table = tableStore.get(key);
if (table.isEmpty()) {
errors.add(new BatchDeleteTableError(
tableName,
new ErrorDetail("EntityNotFoundException", "Table " + tableName + " not found")));
continue;
}
deleteTable(databaseName, tableName);
}
return errors;
}
return errors;
}
public void updateColumnStatisticsForTable(