Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Can we remove the expandSparse call in WriteAt? #43

Closed
schomatis opened this issue Oct 23, 2018 · 5 comments
Closed

Can we remove the expandSparse call in WriteAt? #43

schomatis opened this issue Oct 23, 2018 · 5 comments
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue status/deferred Conscious decision to pause or backlog topic/technical debt Topic technical debt

Comments

@schomatis
Copy link
Contributor

Now that we are including it in Sync (#33).

It would also be helpful to review the entire function itself.

@schomatis schomatis added help wanted Seeking public contribution on this issue topic/technical debt Topic technical debt status/ready Ready to be worked exp/novice Someone with a little familiarity can pick up labels Oct 23, 2018
@kjzz
Copy link
Contributor

kjzz commented Oct 24, 2018

} else if uint64(offset) != dm.curWrOff {
size, err := dm.Size()
if err != nil {
return 0, err
}
if offset > size {
err := dm.expandSparse(offset - size)
if err != nil {
return 0, err
}

In the WriteAt , it use DagModifier.Size() to get size.But the DagModifier.Size() may be larger than fileSize(ipld.node).May it will casue somthing wrong?

@schomatis
Copy link
Contributor Author

In the WriteAt , it use DagModifier.Size() to get size.

Yes, it returns the size taking into account the write buffer that's not flushed yet.

But the DagModifier.Size() may be larger than fileSize(ipld.node).May it will casue somthing wrong?

I don't think so, there are two different checks to call expandSparse with the corresponding different size methods (that should be clearly distinguished) but it seems to me that the check in Sync should cover the check in WriteAt, that is, if we're writing past the potential size of the file (taking into account the write buffer) then definitely the (now adjusted writeStart) should trigger the expandSparse in Sync.

@schomatis
Copy link
Contributor Author

@kjzz Could you remove that expandSparse call and check if it triggers any errors in the tests? (That is not enough to be sure it can be safely removed from the code but it's a good first step.)

@kjzz
Copy link
Contributor

kjzz commented Oct 30, 2018

@schomatis It can passed all test if we remove the expandSparse call in writeAt.

@Stebalien Stebalien added status/deferred Conscious decision to pause or backlog and removed status/ready Ready to be worked labels Dec 18, 2018
@Jorropo
Copy link
Contributor

Jorropo commented Jun 26, 2023

This repository is no longer maintained and has been copied over to Boxo. In an effort to avoid noise and crippling in the Boxo repo from the weight of issues of the past, we are closing most issues and PRs in this repo. Please feel free to open a new issue in Boxo (and reference this issue) if resolving this issue is still critical for unblocking or improving your usecase.

You can learn more in the FAQs for the Boxo repo copying/consolidation effort.


See ipfs/boxo#224 too

@Jorropo Jorropo closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue status/deferred Conscious decision to pause or backlog topic/technical debt Topic technical debt
Projects
No open projects
Archived in project
Development

No branches or pull requests

4 participants