-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bypass task scheduler for reading unsealed pieces #6280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good 👍 - Just a few nits
I suggest in the description of the PR we add a checkbox list of things that have been done (implement change) and things that need to be done before this PR is ready to be reviewed (adding tests) |
return nil, xerrors.Errorf("failed to read sector %v from remote(%d): %w", s, ft, storiface.ErrSectorNotFound) | ||
} | ||
|
||
// TODO Why are we sorting in ascending order here -> shouldn't we sort in descending order as higher weight means more likely to have the file ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks incorrect, right ? We should sort in descending order of weight because a higher weight means a higher probability that it'll have the unsealed file we are looking for here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dirkmc Have addresses all your review comments. Unit Tests are WIP.
return nil, xerrors.Errorf("failed to read sector %v from remote(%d): %w", s, ft, storiface.ErrSectorNotFound) | ||
} | ||
|
||
// TODO Why are we sorting in ascending order here -> shouldn't we sort in descending order as higher weight means more likely to have the file ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's probably a bug, also in acquireFromRemote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't have much impact, as in most cases sectors are only in one storage, which is likely why it wasn't noticed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First review pass, looks good.
We should also bump the minor miner/worker api versions in api/version.go
given that the storage http api now has the new endpoint
Also ideally we'd test this on a mainnet miner with some workers before merging just to confirm it doesn't have issues in real-world setups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good Aarsh 👍
I'll hold off on approving until we have the tests in place
@@ -17,6 +18,14 @@ func (i UnpaddedByteIndex) Padded() PaddedByteIndex { | |||
return PaddedByteIndex(abi.UnpaddedPieceSize(i).Padded()) | |||
} | |||
|
|||
func (i UnpaddedByteIndex) Valid() error { | |||
if i%127 != 0 { | |||
return xerrors.Errorf("unpadded byte index must be a multiple of 127") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return xerrors.Errorf("unpadded byte index must be a multiple of 127") | |
return xerrors.Errorf("unpadded byte index is %d but must be a multiple of 127", i) |
|
9c6462f
to
ed4d54b
Compare
b606f8a
to
c17300d
Compare
@@ -87,7 +86,6 @@ type WorkerCalls interface { | |||
ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (CallID, error) | |||
MoveStorage(ctx context.Context, sector storage.SectorRef, types SectorFileType) (CallID, error) | |||
UnsealPiece(context.Context, storage.SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (CallID, error) | |||
ReadPiece(context.Context, io.Writer, storage.SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize) (CallID, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
svc := &http.Server{ | ||
Addr: nl.Addr().String(), | ||
Handler: mux, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use https://golang.org/pkg/net/http/httptest if it would simplify things
|
||
var uns bool | ||
|
||
if r == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if r == nil
we don't have to call unlock
? Because we do have a few returns in this branch that are not calling unlock
...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If r == nil unlock is called within tryReadUnsealedPiece:
https://github.com/filecoin-project/lotus/pull/6280/files/40642b2cad0bb247dd789837c6465163e5b59742#diff-1fe5f948c5ef6d7d11919b998fedd74927b0cfac11ebb3ef1dbaf518fc026999R61
I found this very hard to follow as well, I wonder if there's a way we can refactor to simplify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good Aarsh, I love these comprehensive unit and integration tests 👍 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, if testing on mainnet goes well we can probably just merge
50e023e
to
21e6b50
Compare
@magik6k The failing tests look like flakies. Please can you merge the PR if you are happy ? |
|
@magik6k The |
Picks the minimal set of changes we need from @magik6k's PR at #6128.
TODO
Unit Tests.
Reader
API on the Remote Store that tries to read an unsealed piece from an already unsealed file on any of the workers.SectorUnseal
API in the Manager.Integration Tests.
Testing on a devnet/pond with 8MB sector size.
Manual test against mainnet miner (running single worker)