You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "dor-bernstein (via GitHub)" <gi...@apache.org> on 2025/04/23 10:21:45 UTC
[I] Issue in multiple appends in one transaction [iceberg-python]
dor-bernstein opened a new issue, #1946:
URL: https://github.com/apache/iceberg-python/issues/1946
### 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:
```python
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()
```
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
- [ ] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [x] I cannot contribute a fix for this bug at this time
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue in multiple appends in one transaction [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on issue #1946:
URL: https://github.com/apache/iceberg-python/issues/1946#issuecomment-2853532054
Hey @dor-bernstein If there are any updates left, it will still try to process them.
https://github.com/apache/iceberg-python/pull/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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue in multiple appends in one transaction [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko closed issue #1946: Issue in multiple appends in one transaction
URL: https://github.com/apache/iceberg-python/issues/1946
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue in multiple appends in one transaction [iceberg-python]
Posted by "dor-bernstein (via GitHub)" <gi...@apache.org>.
dor-bernstein commented on issue #1946:
URL: https://github.com/apache/iceberg-python/issues/1946#issuecomment-2849064077
@Fokko Can I leave the context manager without triggering a commit? I prefer to be more explicit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue in multiple appends in one transaction [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on issue #1946:
URL: https://github.com/apache/iceberg-python/issues/1946#issuecomment-2846738918
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:
```python
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 🚀
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue in multiple appends in one transaction [iceberg-python]
Posted by "dor-bernstein (via GitHub)" <gi...@apache.org>.
dor-bernstein commented on issue #1946:
URL: https://github.com/apache/iceberg-python/issues/1946#issuecomment-2853556545
@Fokko looks good, thanks for handling this so quickly!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Issue in multiple appends in one transaction [iceberg-python]
Posted by "tom-at-rewbi (via GitHub)" <gi...@apache.org>.
tom-at-rewbi commented on issue #1946:
URL: https://github.com/apache/iceberg-python/issues/1946#issuecomment-3111016059
is the intended behavior for multiple commits within a single transaction that pending appends are uploaded without completing the transaction?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org