AKS icon indicating copy to clipboard operation
AKS copied to clipboard

[BUG] Blob storage does not overwrite files with the same name.

Open win5923 opened this issue 1 year ago • 5 comments

Describe the bug When overwriting a file with the same name in Azure Blob storage, the file content remains unchanged or old.

To Reproduce

  1. Bind PV (Persistent Volume) and PVC (Persistent Volume Claim) to Pods.
  2. Add a file "test2.json".
  3. Attempt to overwrite the file with the same name.
  4. The file content remains unchanged.

Expected behavior Files with the same name should be overwriteable.

Screenshots First file: image

Pod's file: image

Second file to overwrite: image

Pod's file did not overwrite: image

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

win5923 avatar Jul 17 '24 06:07 win5923

@andyzhangx, would you be able to help?

win5923 avatar Jul 17 '24 08:07 win5923

@vibhansa-msft could you help? thx

andyzhangx avatar Jul 17 '24 15:07 andyzhangx

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.

vibhansa-msft avatar Jul 19 '24 06:07 vibhansa-msft

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.

image

win5923 avatar Jul 19 '24 07:07 win5923

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.

kamilzzz avatar Jul 24 '24 21:07 kamilzzz

Action required from @aritraghosh, @julia-yin, @AllenWen-at-Azure