[BUG] Blob storage does not overwrite files with the same name.
Describe the bug When overwriting a file with the same name in Azure Blob storage, the file content remains unchanged or old.
To Reproduce
- Bind PV (Persistent Volume) and PVC (Persistent Volume Claim) to Pods.
- Add a file "test2.json".
- Attempt to overwrite the file with the same name.
- The file content remains unchanged.
Expected behavior Files with the same name should be overwriteable.
Screenshots
First file:
Pod's file:
Second file to overwrite:
Pod's file did not overwrite:
Environment (please complete the following information):
- CLI Version [e.g. 3.22]
- Kubernetes version [e.g. 1.24.3]: 1.28.9
- CLI Extension version [e.g. 1.7.5] if applicable
- Browser [e.g. chrome, safari] is applicable
Additional context PV.yml:
csi:
driver: blob.csi.azure.com
volumeAttributes:
isHnsEnabled: 'true'
protocol: fuse
skuName: Standard_LRS
accessModes:
- ReadWriteMany
mountOptions:
- '-o allow_other'
- '--file-cache-timeout-in-seconds=120'
- '--use-attr-cache=true'
- '--cancel-list-on-mount-seconds=10'
- '-o attr_timeout=120'
- '-o entry_timeout=120'
- '-o negative_timeout=120'
- '--log-level=LOG_WARNING'
- '--cache-size-mb=1000'
- '--use-adls=true'
volumeMode: Filesystem
@andyzhangx, would you be able to help?
@vibhansa-msft could you help? thx
There is no flag in blobfuse to allow overwrite of a file. Any instance where application writes to a file and closes the file handle the data will be persisted to storage container. Kindly validate from your application end whether you are closing the file handle after the write call or not. You can also enable log debug and that will give clear indication on whether close calls were received or not and when file was synced to storage.
Hi @vibhansa-msft , Thanks for your reply.
I am not writing within the application; instead, I am uploading the same file from Azure Blob to overwrite it. (k8s pv bound to a container). However, when I check inside the Pod, it always shows the old content.
Isn't this related to blobfuse caching?
Blobfuse driver docs explicitly mention that:
Why am I not able to see the updated contents of file(s), which were updated through means other than Blobfuse2 mount?
If your use-case involves updating/uploading file(s) through other means and you wish to see the updated contents on Blobfuse2 mount then you need to disable kernel page-cache. -o direct_io CLI parameter is the option you need to use while mounting. Along with this, set file-cache-timeout=0 and all other libfuse caching parameters should also be set to 0. User shall be aware that disabling kernel cache can result into more calls to Azure Storage which will have cost and performance implications.
Action required from @aritraghosh, @julia-yin, @AllenWen-at-Azure