-
Notifications
You must be signed in to change notification settings - Fork 275
Issue in multiple appends in one transaction #1946
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
Comments
Hey @dor-bernstein Thanks for raising this. Do you have the full stack trace by any chance? I see in the code that you probably commit twice: with table.transaction() as tx:
for offset in range(0, data.num_rows, MAX_APPEND_CHUNK_SIZE):
data_slice = data.slice(offset, MAX_APPEND_CHUNK_SIZE)
logger.info(f'Writing batch of {data_slice.num_rows} with offset {offset} to table {table.name()}')
tx.append(data_slice)
tx.commit_transaction() <-- this will commit
<-- Leaving the context manager will also trigger a commit Please let me know, it would be great to get this fixed 🚀 |
@Fokko Can I leave the context manager without triggering a commit? I prefer to be more explicit |
Hey @dor-bernstein If there are any updates left, it will still try to process them. #1961 will also allow you to commit within the context manager. Once the PR is in, the code above will pass without any error. Let me know what you think |
@Fokko looks good, thanks for handling this so quickly! |
Apache Iceberg version
None
Please describe the bug 🐞
Hey,
I have a large arrow table that I want to append to a partitioned iceberg table.
I'm working locally with dockers and I'm using the tabulario/iceberg-rest:1.6.0 as my rest catalog.
To avoid OOMs, I'm splitting the arrow table into chunks. When using regular appends everything works as expected. However, I want to append all data in a single transaction. I have this code that does that:
The table is empty and was created in a different task.
I get the following error - CommitFailedException: Requirement failed: branch main was created concurrently.
When retrying I get this error pyiceberg.exceptions.CommitFailedException: CommitFailedException: Requirement failed: branch main has changed: expected id 4547037169132709864 != 132570956257248456.
Any help would be appreciated,
Thanks!
Willingness to contribute
The text was updated successfully, but these errors were encountered: