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

Vibhansa/truncate update #1517

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

Conversation

vibhansa-msft
Copy link
Member

No description provided.

}
return data, err

return bb.createSparseFile(name, newSize, blockSize, blkList, idLen)
Copy link
Member

Choose a reason for hiding this comment

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

If file size is not aligning with the block size and truncate is used to expand the size, this will lead to irregular blocksizes in the block list.
Eg: lets say blocksize = 4M
file size = 5M (i.e., 2blocks) block1 = 4M, block2 = 1M

Call for truncate(10M)

I suppose the logic in this PR will make the block list look like this after truncate operation:
block1 = 4M, block2 = 1M, block3 = 4M, block4 = 1M.
Although this looks correct but the subsequent operations in block cache cannot utilize this sort of blocklist.
Please correct me if I am wrong

@vibhansa-msft vibhansa-msft changed the base branch from main to blobfuse/2.4.1 November 29, 2024 08:01
return blockList
}

func (bb *BlockBlob) TruncateFile(name string, size int64) error {
// log.Trace("BlockBlob::TruncateFile : name=%s, size=%d", name, size)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed the commented line

data, err := bb.HandleSmallFile(name, size, attr.Size)
if blockSize == 0 {
// Nothing is configured then assume 16MB as default size
blockSize = 16 * 1024 * 1024
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this standard size? if not, we have to document it somewhere.

_ = h.Close()
os.Remove(filename)

err = suite.az.TruncateFile(internal.TruncateFileOptions{Name: filename, Size: fs.TruncatedSize, BlockSize: 16 * MB})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also verify the block size for 1,2 use case after truncate.

@@ -0,0 +1,55 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this file needed?

@vibhansa-msft vibhansa-msft removed this from the v2-2.4.1 milestone Jan 15, 2025
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.

5 participants