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

kvserver: avoid engine bypass in sideload storage #59134

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

tbg
Copy link
Member

@tbg tbg commented Jan 19, 2021

While investigating #59126, I realized we were still going through the
engine for listing the files. I rectified this and as a result,
completely removed the in-mem implementation of the sideloaded storage
that we had in place: instead of it, we simply use an in-mem engine,
which now works like a charm thanks to not bypassing the engine for
listing the file contents (filepath.Glob --> eng.List).

While I was here, I added some defense in depth: it was unreasonable
that TruncateTo was returning an error as a result of failing to
perform best-effort cleanup on its directory.

I am no longer seeing the spurious errors observed in #59126 with
this change.

Touches #59126.
Touches #31913.
Fixes #58948.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg requested a review from jbowens January 19, 2021 12:08
@tbg tbg marked this pull request as ready for review January 19, 2021 12:08
Copy link
Collaborator

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

:LGTM:

Thanks for fixing that! Looks like I missed the Glob in #49717!

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@tbg
Copy link
Member Author

tbg commented Jan 20, 2021

Thanks for the review!

bors r=jbowens

While investigating cockroachdb#59126, I realized we were still going through the
engine for listing the files. I rectified this and as a result,
completely removed the in-mem implementation of the sideloaded storage
that we had in place: instead of it, we simply use an in-mem engine,
which now works like a charm thanks to not bypassing the engine for
listing the file contents (`filepath.Glob` --> `eng.List`).

While I was here, I added some defense in depth: it was unreasonable
that `TruncateTo` was returning an error as a result of failing to
perform best-effort cleanup on its directory.

I am no longer seeing the spurious errors observed in cockroachdb#59126 with
this change. This makes sense, as in this test the sideloaded storage
is set up with an in-memory engine. The old code, which read from
actual disk, would try to glob `auxiliary/...` (i.e. some path relative
to the cwd - oops), which would return no results. As a result, the
sideloaded storage would try to invoke `eng.Remove("auxiliary/...")`
which the engine would refuse, since there would actually be (in-mem)
files stored in the engine. This all resolves now that everyone is
looking at the same files.

It's possible that this fixes the issue with BenchmarkUserFile, as
previously errors from TruncateTo could block the raft log queue,
which in turn could at least slow down the test, but it's hard to
say for sure.

Touches cockroachdb#59126.
Touches cockroachdb#31913.

Release note: None
@craig
Copy link
Contributor

craig bot commented Jan 20, 2021

Canceled.

@tbg
Copy link
Member Author

tbg commented Jan 20, 2021

bors r=jbowens

@craig
Copy link
Contributor

craig bot commented Jan 20, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 20, 2021

Build failed:

@tbg
Copy link
Member Author

tbg commented Jan 20, 2021

Can't merge because

[Prepare environment] curl: (22) The requested URL returned error: 503 Service Unavailable: Back-end server is at capacity

@tbg
Copy link
Member Author

tbg commented Jan 21, 2021

bors r=jbowens

@craig
Copy link
Contributor

craig bot commented Jan 21, 2021

Build succeeded:

@craig craig bot merged commit c978f14 into cockroachdb:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kvserver: diskSideloadedStorage.TruncateTo can cause spurious errors
3 participants