Skip to content

stored: explicitly flush after labeling#2022

Merged
BareosBot merged 3 commits intobareos:masterfrom
arogge:fix-issue-2020
Nov 29, 2024
Merged

stored: explicitly flush after labeling#2022
BareosBot merged 3 commits intobareos:masterfrom
arogge:fix-issue-2020

Conversation

@arogge
Copy link
Member

@arogge arogge commented Nov 18, 2024

this is needed to make sure the volume is flushed to the backing storage so a subsequent read of the label will work.

This fixes #2020.

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR

@arogge arogge added this to the 24.0.0 milestone Nov 18, 2024
@sebsura
Copy link
Contributor

sebsura commented Nov 18, 2024

Could you add some more explanation ? From what i can tell, labeling just uses our normal write routines to write the data.

For me this means that if the size is sometimes wrong during labeling, then it will also be wrong during normal writing or do i have that wrong ? E.g. if I have a test that writes a backup and then immediately tries to restore it.

@sebsura
Copy link
Contributor

sebsura commented Nov 18, 2024

Also i though that reading from unfushed data works by reading it from the queue. If this is not the case, then reading should definitely flush the data first. (Maybe we can skip this if we can make sure that no data in the queue would affect our reads).

@arogge arogge requested a review from pstorz November 19, 2024 09:36
@arogge
Copy link
Member Author

arogge commented Nov 27, 2024

So I managed to pinpoint the actual bug (d_lseek(dcr, 0, SEEK_END) didn't work correctly in that situation) and fix it, too.
I also added a comment why we d_flush() in label.cc.

Copy link
Contributor

@sebsura sebsura left a comment

Choose a reason for hiding this comment

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

This looks correct.

this is needed to make sure the volume is flushed to the backing
storage so a subsequent read of the label will work.
While writing to a chunk, a call to ChunkedVolumeSize() would not return
the correct size, as it got the size by either looking at the upload
queue or asking the backend storage.
The patch adds a third option: if the current chunk has been written,
its last offset represents the end of the volume.
@BareosBot BareosBot merged commit 6f2303e into bareos:master Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This addresses a bug requires backport to 23

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Virtual Full S3/droplet Backup Broken Since 23.1.0

3 participants