Skip to content

Refactor config reloading by using shared pointers instead of callbacks#1151

Merged
pstorz merged 36 commits intomasterfrom
dev/pstorz/master/refactor-config-reload
Aug 11, 2022
Merged

Refactor config reloading by using shared pointers instead of callbacks#1151
pstorz merged 36 commits intomasterfrom
dev/pstorz/master/refactor-config-reload

Conversation

@pstorz
Copy link
Member

@pstorz pstorz commented Apr 6, 2022

The original way of handling the reload mechanism used callbacks that were registerd on every job start with internal job counters that would free the used configuration resources when no job is using it anymore.

Now the new mechanism simply uses shared pointers that own the configuration resources. On every job start, each job becomes shared owner of the resources, and on successfull reload the prevous confiugration resources are released by the director itself, so that only currently using jobs own the resource. When the last job using the configuration resources ends the resources are automatically freed.

The definitions of resources have been simplified by starting the resource definitons now with 0 in all daemons instead of having a number for start and end.

In addition, the formerly used static global definitions of the resources now have been converted to be dynamic.

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)

General
  • PR name is meaningful
  • Purpose of the PR is understood
  • Separate commit for this PR in the CHANGELOG.md, PR number referenced is same
  • Commit descriptions are understandable and well formatted
    - [ ] If backport: add original PR number and target branch at top of this file: Backport of PR#000 to bareos-2x
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
  • bareos-check-sources --since-merge does not report any problems
  • git status should not report modifications in the source tree after building and testing
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

@pstorz pstorz requested a review from arogge April 7, 2022 07:13
@pstorz pstorz force-pushed the dev/pstorz/master/refactor-config-reload branch from a8d7fb4 to 31b4e2c Compare April 26, 2022 08:59
polz113 pushed a commit to polz113/bareos that referenced this pull request May 3, 2022
In order to quickly identify which volumes are available by your
autochanger an additional column is introduced on volume tables.

Fixes bareos#1151: bareos webui does not show the inchanger flag for volumes
Copy link
Member Author

@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.

Looks good to me. Good work!

@pstorz pstorz force-pushed the dev/pstorz/master/refactor-config-reload branch 3 times, most recently from f24dc6d to bd91589 Compare July 25, 2022 08:39
pstorz and others added 24 commits August 4, 2022 11:50
Co-authored-by: Andreas Rogge <andreas.rogge@bareos.com>
Co-authored-by: Andreas Rogge <andreas.rogge@bareos.com>
Co-authored-by: Andreas Rogge <andreas.rogge@bareos.com>
Co-authored-by: Andreas Rogge <andreas.rogge@bareos.com>
Calling my_config->BackupResourceTable() avoids memleaks if a new config
is parsed while another already exists.
@alaaeddineelamri alaaeddineelamri force-pushed the dev/pstorz/master/refactor-config-reload branch from c4a12e8 to f96a0b5 Compare August 4, 2022 10:47
@pstorz pstorz merged commit d60c4f1 into master Aug 11, 2022
@pstorz pstorz deleted the dev/pstorz/master/refactor-config-reload branch August 11, 2022 10:16
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.

3 participants