Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented May 2, 2025

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?

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.
Fokko and others added 3 commits May 3, 2025 20:52
Co-authored-by: smaheshwar-pltr <[email protected]>
…okko/iceberg-python into fd-add-test-for-optimistic-concurrency
Comment on lines 76 to 89
@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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this shouldn't fail, but it does with the current OCC implementation, we may add a todo comment to remove it when #819 is completed, to indicate to the developer working on #1929 that it is safe to remove/update this test.

Copy link
Contributor Author

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

Copy link
Collaborator

@sungwy sungwy left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants