You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test(timeOut = 60_000)
public void testConcurrentOptimize()
throws Exception
{
int threads = 20;
ExecutorService executor = newFixedThreadPool(threads);
try (TestTable table = new TestTable(
getQueryRunner()::execute,
"test_concurrent_update",
"(int_col INT)")) {
String tableName = table.getName();
// Populate some data, it is important that each file only contains one row
// since the issue is with metadata deletes, not positional deletes
for (int i = 0; i < threads; i++) {
assertUpdate(format("INSERT INTO %s VALUES %s", tableName, i), 1);
}
// Start a bunch of delete operations which should perform metadata deletes using `DeleteFiles`
List<Future<?>> futures = IntStream.range(0, threads)
.mapToObj(threadNumber -> executor.submit(() -> {
getQueryRunner().execute(format("DELETE FROM %s WHERE int_col = %s", tableName, threadNumber));
}))
.collect(toImmutableList());
// While these deletes are running, rewrite all the data files in the table
assertUpdate("ALTER TABLE %s EXECUTE optimize".formatted(tableName));
for (Future<?> future : futures) {
// Ensure all futures return successfully
future.get();
}
assertThat(query("SELECT * FROM " + tableName)).returnsEmptyResult();
}
finally {
executor.shutdownNow();
executor.awaitTermination(10, SECONDS);
}
}
The text was updated successfully, but these errors were encountered:
Thanks @danielcweeks for reporting!
The gist of it is that we should not be using the DeleteFiles API to remove entire data files here: https://github.com/trinodb/trino/blob/master/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java#L2232C21-L2232C21
since it does not ensure that the deleted file still exists
Instead we should try using OverwriteFiles
The text was updated successfully, but these errors were encountered: