azure-storage-file-datalake `rename` with `DataLakeLeaseClient`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Start with the reproducer using source.acquire_lease() and source.rename_file(...), then read the lease context-manager logic in azure/storage/filedatalake/_data_lake_lease.py and the rename implementations for rename_file, rename_directory, and _rename_file_system. Trace how source_lease is applied during rename and how release/__exit__ determines the target path; add a regression test covering rename inside the lease context and verify the lease is released against the renamed path.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- Package Name: azure-storage-file-datalake
- Package Version: 12.26.1
- Operating System: MacOS
- Python Version: 3.13
Describe the bug
When calling acquire_lease in a Context Manager on azure.storage.filedatalake.FileSystemClient, azure.storage.filedatalake.DataLakeDirectoryClient, or azure.storage.filedatalake.DataLakeFileClient followed by a _rename_file_system, rename_directory, or rename_file, respectively, causes an error to be thrown when exiting the Context Manager.
Additionally, this leaves the newly renamed file in a leased state as it maintains the lease the previously named file had on it when it was renamed.
To Reproduce
Steps to reproduce the behavior:
credential = azure.identity.DefaultAzureCredential()
connection = azure.storage.filedatalake.DataLakeServiceClient(
account_url=f"https://{storage_account}.dfs.core.windows.net",
credential=credential,
)
source = connection.get_file_client(
file_system="abc",
file_path="def.txt",
)
with source.acquire_lease() as lease:
source.rename_file("ghi/jkl.txt", lease=lease)
Throws:
with source.acquire_lease() as lease:
^^^^^^^^^^^^^^^^^^^^^^
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/filedatalake/_data_lake_lease.py", line 70, in __exit__
self.release()
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/filedatalake/_data_lake_lease.py", line 183, in release
self._blob_lease_client.release(**kwargs)
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_lease.py", line 228, in release
process_storage_error(error)
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_shared/response_handlers.py", line 198, in process_storage_error
raise error from None
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_lease.py", line 220, in release
response: Any = self._client.release_lease(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/tracing/decorator.py", line 119, in wrapper_use_tracer
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/storage/blob/_generated/operations/_blob_operations.py", line 3155, in release_lease
map_error(status_code=response.status_code, response=response, error_map=error_map)
File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/core/exceptions.py", line 163, in map_error
raise error
azure.core.exceptions.ResourceNotFoundError: The specified blob does not exist.
RequestId:d8882ade-701e-009b-30c7-81fbb5000000
Time:2026-12-01T19:07:51.6008552Z
ErrorCode:BlobNotFound
Content: <?xml version="1.0" encoding="utf-8"?><Error><Code>BlobNotFound</Code><Message>The specified blob does not exist.
RequestId:d8882ade-7013-019b-30d7-abcbb5000000
Time:2026-12-01T19:00:00.0000000Z</Message></Error>
Expected behavior
I would expect the above code to complete without an Error being thrown. The result of the rename_file call should appropriately mutate the state of the azure.storage.filedatalake.DataLakeLeaseClient, so it correctly points to the renamed location and calling release or __exit__ should appropriately release the lease on the renamed location.
Additional context
If the above described mutation of the passed in azure.storage.filedatalake.DataLakeLeaseClient is deemed a change that is unacceptable, then I would expect more information be supplied in the pydoc description of the source_lease kwarg so it is clear that passing a azure.storage.filedatalake.DataLakeLeaseClient will render that object useless and it should not be used in a Context Manager.
- Ngôn ngữ chính
- Python
- Star
- 5.6k
- Fork
- 3.4k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 189
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/azure-sdk-for-python
-
SyntaxWarning: Invalid escape sequence \/ in `azure-mgmt-resource-deploymentstacks` 1.0.0Có thể đã có người làm @msyyc đã nhận 7 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Azure/azure-sdk-for-python#50155 · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Teams Chatbot]: next-mypy install 404s should point to CFS auth or --pypi workaroundCó thể đã có người làm @jianingwang123 đã nhận 24 ngày trước. Đang mởneeds-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-sdk-for-python#49886 · 1 bình luận · 2 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[AI Projects] AIProjectInstrumentor: non-streamed responses.create raises AttributeError ('NonRecordingSpan' object has no attribute 'attributes') when the span is not sampledCó thể đã có người làm @14H034160212 đã nhận 26 ngày trước. Đang mởAI Projects Client customer-reported question
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Azure/azure-sdk-for-python#49854 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
azure-eventhub migration guide: legacy checkpoint sample writes "None" metadata for partitions that were never checkpointedCó thể đã có người làm @hidingmyname đã nhận 34 ngày trước. Đang mởClient customer-reported Event Hubs needs-team-attention question Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Azure/azure-sdk-for-python#49723 · 2 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Scheduled test pipelines fail at the Analyze_Test stage due to date formattingCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởEngSys
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Azure/azure-sdk-for-python#49614 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/azure-sdk-for-python
Issue tương tự
-
area/network kind/documentation triage/needs-human
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
canonical/k8s-snap#3533 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: ops bug effort: small
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
juandresrodca/AdminForge#71 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fossasia/eventyay-exhibition#465 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Deltakit/deltakit-circuit#28 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày