skyyyy955 opened a new issue, #11300:
URL: https://github.com/apache/paimon/issues/11300
### Search before asking
- [x] I checked existing reports. #11281 and #11282 cover the Java
implementation. I can reproduce the same behavior through the Python filesystem
catalog.
### Paimon version
2.2-SNAPSHOT, `7a30ef580e8d78b3130ba944fce4530b335f5724`
### Compute Engine
PyPaimon on Windows, Python 3.10.11, PyArrow 19.0.1, local filesystem and
Parquet.
### Minimal reproduce step
Start with a fresh Parquet append table that has one committed snapshot (ID
1). Set `warehouse` to the catalog's warehouse directory and `name` to the
table's full name. The example uses two independent clients. The barrier just
starts the two public API calls together.
```python
from concurrent.futures import ThreadPoolExecutor
from threading import Barrier
from pypaimon import CatalogFactory
def client():
return CatalogFactory.create({"warehouse": warehouse})
for kind in ("branch", "tag"):
owner = client()
if kind == "branch":
owner.create_branch(name, "old")
else:
owner.get_table(name).create_tag("old", snapshot_id=1)
clients = [client(), client()]
targets = ["new_a", "new_b"]
start = Barrier(2)
def rename(i):
start.wait(timeout=15)
try:
getattr(clients[i], "rename_" + kind)(name, "old", targets[i])
return "ok"
except Exception as error:
return type(error).__name__
with ThreadPoolExecutor(max_workers=2) as pool:
results = list(pool.map(rename, (0, 1)))
fresh = client()
names = fresh.list_branches(name) if kind == "branch" else
fresh.get_table(name).list_tags()
print(kind, results, sorted(set(targets) & set(names)))
```
### What doesn't meet your expectations?
Both callers returned `ok`, but the old name was gone and only one of the
two target names existed. A caller can therefore be told that a rename
succeeded and then fail to find its branch or tag under the new name.
With fresh names each time, I saw this in 12/12 branch trials and 12/12 tag
trials. A single-client rename produced the expected target in both cases. In
the concurrent case, only the caller whose rename took effect should report
success.
### Anything else?
Both clients can pass the existence checks before either moves the file.
When the first move wins, `LocalFileIO.rename()` can return `False` to the
second caller. Both Python managers currently discard that return value.
[Branch
rename](https://github.com/apache/paimon/blob/7a30ef580e8d78b3130ba944fce4530b335f5724/paimon-python/pypaimon/branch/filesystem_branch_manager.py#L249)
· [Tag
rename](https://github.com/apache/paimon/blob/7a30ef580e8d78b3130ba944fce4530b335f5724/paimon-python/pypaimon/tag/tag_manager.py#L286)
·
[LocalFileIO.rename](https://github.com/apache/paimon/blob/7a30ef580e8d78b3130ba944fce4530b335f5724/paimon-python/pypaimon/filesystem/local_file_io.py#L244-L250)
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR.
Could you assign this to me? I'd like to check the rename result in both
managers, include the source and target names in the error, and add tests that
verify the persisted names after failure and retry.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]