-
Notifications
You must be signed in to change notification settings - Fork 278
Add tests for optimistic concurrency #1962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I think it would be great to also have integration tests that makes it easy to replicate certain scenarios. Added some simple ones, but we can extend by having two tables that modify a different partition etc.
Co-authored-by: smaheshwar-pltr <[email protected]>
…okko/iceberg-python into fd-add-test-for-optimistic-concurrency
@pytest.mark.integration | ||
@pytest.mark.parametrize("format_version", [1, 2]) | ||
def test_conflict_append_append( | ||
spark: SparkSession, session_catalog: Catalog, arrow_table_with_null: pa.Table, format_version: int | ||
) -> None: | ||
identifier = "default.test_conflict" | ||
tbl1 = _create_table(session_catalog, identifier, {"format-version": format_version}, [arrow_table_with_null]) | ||
tbl2 = session_catalog.load_table(identifier) | ||
|
||
tbl1.append(arrow_table_with_null) | ||
|
||
with pytest.raises(CommitFailedException, match="(branch main has changed: expected id ).*"): | ||
# tbl2 isn't aware of the commit by tbl1 | ||
tbl2.append(arrow_table_with_null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hussein-awala for jumping in here. And that's correct, once the optimistic concurrency control has been added, they should start passing (for snapshot isolation, not for serializable isolation). I've added a comment, LMKWYT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review @Fokko - this looks good to me. Excited to see how this test evolves with the introduction of optimistic concurrency features
I think it would be great to also have integration tests that make it easy to replicate certain scenarios.
Added some simple ones, but we can extend by having two tables that modify a different partition etc.
Rationale for this change
Are these changes tested?
Are there any user-facing changes?