Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the number of rest calls while doing Rename Operation #1614

Open
wants to merge 9 commits into
base: blobfuse/2.4.1
Choose a base branch
from

Conversation

syeleti-msft
Copy link
Member

@syeleti-msft syeleti-msft commented Jan 20, 2025

✅ What

Currently we invalidate the cache item of destination (to remove the older reference of detination in our cache) after the rename operation completes[, this can be identified in the final call of the following flow:
Rename on FNS:
API calls: There are 5 REST api calls assosiated with this operation.

  1. GetAttr(src)---------list call (filesystem call)
  2. GetAttr(dst)---------list call (filesystem call)
  3. copyblob(src->dst)----------(rename function)
  4. deleteblob(src)--------------(rename function)
  5. GetAttr(dst)---------list call (filesystem call)

Rename on HNS:
API Calls: There are 4 REST api calls assosiated with this operation.

  1. GetAttr(Dst)
  2. GetAttr(Src)
  3. RenamePathFile
  4. GetAttr(dst)

goal is to serve the last call(invalidatePath) for FNS&HNS in the above REST calls from the attribute cache.

🤔 Why

The idea is to simply copy source Attributes in the destination file object when the rename is success.
The only thing that modified in the destination was the last modified time, it will be modified according to the response of REST call for rename in AzStorage Component.

👩‍🔬 How to validate if applicable

Do rename operation with "mv" and see that the Final GetAttr on Dst after rename is success will be served from the cache.

err = suite.attrCache.RenameFile(options)
suite.assert.Nil(err)
assertDeleted(suite, src)
assertUntouched(suite, dst)
Copy link
Collaborator

@jainakanksha-msft jainakanksha-msft Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't destination attribute definition be updated by source attribute information?
Same for L.No 700.
Untouched is more like nothing is updated in cache corresponding to the object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't destination attribute definition be updated by source attribute information?

We are updating the src attribute

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In attr_cache, we make sure things are copied to destination, so destination attribute should be updated right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the Tests

// Dst blob may not exist before
dstCacheEntry.attrFlag.Set(AttrFlagExists)
// Refresh the cache
dstCacheEntry.cachedAt = time.Now()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like invalidatePath you can also create a function in attribute cache to updatePath and do this assignment there.
I understand this might be too many parameters but can be reused operation by multiple other objects.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

component/azstorage/block_blob.go Show resolved Hide resolved
@@ -340,6 +344,8 @@ func (bb *BlockBlob) RenameFile(source string, target string) error {
return err
}

var dstLMT *time.Time = startCopy.LastModified
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are picking up LMT from startCopy.
It can be from srcAttr also if needed.
But bigger question is why did we need it at this point.
Only after copying the blob we would need to update the LMT over destination object right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are picking up LMT from startCopy.

we picking it up from the startCopy because many times the Copyblob API copies the file immediately(i.e., you get the x-ms-copystatus=success in the response). in this case we can use LMT that was returned by the copyBlob to update our attribute

Only after copying the blob we would need to update the LMT over destination object right?

I think the variable name is culprit here for misunderstanding, I will update it

component/azstorage/block_blob.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants