Skip to content

Commit

Permalink
[Iceberg]Fix tests failure caused by concurrently handle the same table
Browse files Browse the repository at this point in the history
  • Loading branch information
hantangwangd committed Aug 1, 2024
1 parent 90d1c0d commit 7640fe6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

@Test(singleThreaded = true)
public abstract class TestRemoveOrphanFilesProcedureBase
extends AbstractTestQueryFramework
{
Expand Down Expand Up @@ -97,7 +98,7 @@ public Object[][] timezones()
@Test
public void testRemoveOrphanFilesInEmptyTable()
{
String tableName = "test_empty_table";
String tableName = "test_empty_remove_orphan_files_table";
Session session = getQueryRunner().getDefaultSession();
try {
assertUpdate(format("create table %s (a int, b varchar)", tableName));
Expand All @@ -121,7 +122,7 @@ public void testRemoveOrphanFilesInEmptyTable()
@Test(dataProvider = "timezones")
public void testRemoveOrphanFilesInMetadataAndDataFolder(String zoneId, boolean legacyTimestamp)
{
String tableName = "test_table";
String tableName = "test_remove_orphan_files_table";
Session session = sessionForTimezone(zoneId, legacyTimestamp);
try {
assertUpdate(session, format("create table %s (a int, b varchar)", tableName));
Expand Down Expand Up @@ -172,8 +173,8 @@ public void testRemoveOrphanFilesInMetadataAndDataFolder(String zoneId, boolean
public void testRemoveOrphanFilesWithNonDefaultMetadataPath(String zoneId, boolean legacyTimestamp)
{
Session session = sessionForTimezone(zoneId, legacyTimestamp);
String tempTableName = "temp_test_table";
String tableName = "test_table";
String tempTableName = "temp_test_table_with_specified_metadata_path";
String tableName = "test_table_with_specified_metadata_path";
String tableTargetPath = createTempDir().toURI().toString();
File metadataDir = new File(createTempDir().getAbsolutePath(), "metadata");
metadataDir.mkdir();
Expand Down Expand Up @@ -223,8 +224,8 @@ public void testRemoveOrphanFilesWithNonDefaultMetadataPath(String zoneId, boole
public void testRemoveOrphanFilesWithNonDefaultDataPath(String zoneId, boolean legacyTimestamp)
{
Session session = sessionForTimezone(zoneId, legacyTimestamp);
String tempTableName = "temp_test_table";
String tableName = "test_table";
String tempTableName = "temp_test_table_with_specified_data_path";
String tableName = "test_table_with_specified_data_path";
String tableTargetPath = createTempDir().toURI().toString();
File dataDir = new File(createTempDir().getAbsolutePath(), "metadata");
dataDir.mkdir();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.iceberg.Table;
import org.apache.iceberg.catalog.Catalog;
import org.apache.iceberg.catalog.TableIdentifier;
import org.testng.annotations.Test;

import java.io.File;
import java.util.Map;
Expand All @@ -42,10 +43,10 @@ public TestRemoveOrphanFilesProcedureHadoop()
super(HADOOP, ImmutableMap.of());
}

@Override
@Test(dataProvider = "timezones")
public void testRemoveOrphanFilesWithNonDefaultMetadataPath(String zoneId, boolean legacyTimestamp)
{
String tempTableName = "temp_test_table";
String tempTableName = "temp_test_table_with_specified_metadata_path";
String tableTargetPath = createTempDir().toURI().toString();
String specifiedMetadataPath = createTempDir().getAbsolutePath();

Expand Down

0 comments on commit 7640fe6

Please sign in to comment.