Skip to content

Commit

Permalink
Spark: Fix flaky tests withSnapshotIsolation (#11974)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuzhang authored Jan 16, 2025
1 parent a0777bc commit b128bba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import static org.apache.iceberg.SnapshotSummary.ADD_POS_DELETE_FILES_PROP;
import static org.apache.iceberg.TableProperties.COMMIT_MAX_RETRY_WAIT_MS;
import static org.apache.iceberg.TableProperties.COMMIT_MIN_RETRY_WAIT_MS;
import static org.apache.iceberg.TableProperties.COMMIT_NUM_RETRIES;
import static org.apache.iceberg.TableProperties.DELETE_DISTRIBUTION_MODE;
import static org.apache.iceberg.TableProperties.DELETE_ISOLATION_LEVEL;
import static org.apache.iceberg.TableProperties.DELETE_MODE;
Expand Down Expand Up @@ -1154,14 +1155,16 @@ public synchronized void testDeleteWithSnapshotIsolation()
createOrReplaceView("deleted_id", Collections.singletonList(1), Encoders.INT());

sql(
"ALTER TABLE %s SET TBLPROPERTIES('%s'='%s', '%s'='%s', '%s'='%s')",
"ALTER TABLE %s SET TBLPROPERTIES('%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s')",
tableName,
DELETE_ISOLATION_LEVEL,
"snapshot",
COMMIT_MIN_RETRY_WAIT_MS,
"10",
COMMIT_MAX_RETRY_WAIT_MS,
"1000");
"1000",
COMMIT_NUM_RETRIES,
"7");

sql("INSERT INTO TABLE %s VALUES (1, 'hr')", tableName);
createBranchIfNeeded();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.apache.iceberg.RowLevelOperationMode.MERGE_ON_READ;
import static org.apache.iceberg.TableProperties.COMMIT_MAX_RETRY_WAIT_MS;
import static org.apache.iceberg.TableProperties.COMMIT_MIN_RETRY_WAIT_MS;
import static org.apache.iceberg.TableProperties.COMMIT_NUM_RETRIES;
import static org.apache.iceberg.TableProperties.MERGE_DISTRIBUTION_MODE;
import static org.apache.iceberg.TableProperties.MERGE_ISOLATION_LEVEL;
import static org.apache.iceberg.TableProperties.MERGE_MODE;
Expand Down Expand Up @@ -1618,14 +1619,16 @@ public synchronized void testMergeWithSnapshotIsolation()
createOrReplaceView("source", Collections.singletonList(1), Encoders.INT());

sql(
"ALTER TABLE %s SET TBLPROPERTIES('%s'='%s', '%s'='%s', '%s'='%s')",
"ALTER TABLE %s SET TBLPROPERTIES('%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s')",
tableName,
MERGE_ISOLATION_LEVEL,
"snapshot",
COMMIT_MIN_RETRY_WAIT_MS,
"10",
COMMIT_MAX_RETRY_WAIT_MS,
"1000");
"1000",
COMMIT_NUM_RETRIES,
"7");

sql("INSERT INTO TABLE %s VALUES (1, 'hr')", tableName);
createBranchIfNeeded();
Expand Down

0 comments on commit b128bba

Please sign in to comment.