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

[v22.3.x] archival: lock segments before opening readers #9580

Merged

Conversation

vbotbuildovich
Copy link
Collaborator

Backport of PR #9566
Fixes #9579,

A read lock is placed on any segment that the cloud storage upload loop
selects: compacted or not. The upload loop needs to convert the begin
and end offsets into the segments to file offsets for partial uploads.

Previously, in the case of compacted segment reuploads, the locks were
taken after the conversion to file offsets. When we couple this with the
fact that compacted re-uploads can occur below the latest disk log start
offset, it meant that the segment could be removed with an outstanding
reader before the locks were acquired. This bubbled up and stopped the
upload loop with "Bad file descriptor" errors.

This commit fixes the issue by taking the locks before any readers are
created. Note that the non-compacted upload path does the same thing.

(cherry picked from commit f87763a)
@vbotbuildovich vbotbuildovich added this to the v22.3.x-next milestone Mar 21, 2023
@vbotbuildovich vbotbuildovich added the kind/backport PRs targeting a stable branch label Mar 21, 2023
@vbotbuildovich vbotbuildovich requested a review from Lazin March 21, 2023 10:39
@VladLazar VladLazar marked this pull request as ready for review March 21, 2023 10:44
@VladLazar VladLazar merged commit 1dc1f10 into redpanda-data:v22.3.x Mar 21, 2023
@vshtokman vshtokman modified the milestones: v22.3.x-next, v22.3.15 Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redpanda kind/backport PRs targeting a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants