Skip to content

stored: reserve/acquire a device on first incoming write data#1715

Merged
BareosBot merged 34 commits intobareos:masterfrom
sebsura:dev/ssura/master/only-reserve-device-if-something-to-do
Sep 5, 2024
Merged

stored: reserve/acquire a device on first incoming write data#1715
BareosBot merged 34 commits intobareos:masterfrom
sebsura:dev/ssura/master/only-reserve-device-if-something-to-do

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Feb 14, 2024

Thank you for contributing to the Bareos Project!

The bareos reservation logic reseves a device relatively early in the job processing.
This causes problems especially when using hardware tape drives, because this expensive ressource is unnessesarily
blocked and is not available for other jobs.
This PR moves the device reservation to the latest possible moment, which is when the first data to be written arrives in the storage daemon.
If a job does not produce any data at all (e.g. because no data is available for an incremental job), the device is not reserved at all.
The only drawback in that case is that the information about the job that did not produce any data on the device is not recorded on the medium and could not be scanned into the database in case of a desaster recovery.
As no data was written, this is not a real drawback.

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
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
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch from 56e2cf7 to cc9d8dd Compare February 14, 2024 09:39
Copy link
Member

@pstorz pstorz left a comment

Choose a reason for hiding this comment

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

Please see comments.

@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch from 03503d0 to 244f4db Compare March 4, 2024 09:12
@sebsura sebsura requested a review from pstorz March 5, 2024 09:14
@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch 3 times, most recently from d839d43 to 71cf93a Compare March 20, 2024 07:08
@pstorz pstorz changed the title stored: only reserve/acquire a device if there is something write to the device stored: only reserve/acquire a device if there is something to write to the device Apr 15, 2024
@pstorz pstorz changed the title stored: only reserve/acquire a device if there is something to write to the device stored: reserve/acquire a device on first incoming write data Apr 15, 2024
@sebsura
Copy link
Contributor Author

sebsura commented May 16, 2024

We should update the sd status message during the wait so we know what is happening.

@arogge arogge added this to the 24.0.0 milestone Jun 25, 2024
@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch from d8a167a to dbf02f2 Compare June 27, 2024 12:58
@sebsura sebsura assigned sebsura and unassigned pstorz Jul 19, 2024
reservations_lock_count was not used (and was used improperly), so it
was removed.  reservation_lock is defined as rwlock, but only ever
used as a normal lock, so it was replaced by a std::mutex.
Sadly a lot of logic relies on the fact that jcr->dcr is always set
and jcr->read_dcr is just sometimes set, as such we need to set both
even when just reading (for now).
This should not happen since this function can be called during the
backup, where OK_device/NO_device does not make sense anymore.
Since SetupinewDcrDevice accesses dcr, dcr can never be null after
if (rct.store->append) { ... }, so the if would have never fired.

Since the branches of the if are basically the same, the
SetupNewDcrDevice was extracted out of them.
@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch from 2ae91aa to 04cda38 Compare September 2, 2024 11:13
@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch from 461d811 to 538f310 Compare September 4, 2024 05:18
@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch 4 times, most recently from 6cec6ff to 4cffe99 Compare September 5, 2024 10:36
@sebsura sebsura force-pushed the dev/ssura/master/only-reserve-device-if-something-to-do branch from 4cffe99 to 2b9c043 Compare September 5, 2024 11:15
@BareosBot BareosBot merged commit d5fd2ea into bareos:master Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments