-
Notifications
You must be signed in to change notification settings - Fork 259
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
consolidate: purge jobids without files before starting the consolidation #1056
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answer the question about sending the code in case of exit on fatal.
Changelog Commit needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I let one suggestion open.
76b2a6c
to
f9592a7
Compare
8098589
to
4c3dc77
Compare
4c17c41
to
5680781
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let see if last modification build and tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything reviewed, tested, and build correctly.
Nice work.
core/src/cats/sql_get.cc
Outdated
{ | ||
db_list_ctx deleted_jobids; | ||
std::string query{ | ||
"DELETE FROM Job where (JobFiles=0 OR PurgedFiles=1) AND JobID in ("}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really want to implicitly purge jobs when their files were purged?
I don't think that's right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, just doing an SQL DELETE
will potentially leave stale records in tables JobMedia, Log, basefiles, PathVisibility, NDMPJobEnvironment, JobStats and RestoreObject.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need to determine the list and then do whatever"delete jobid=XXX" would be doing.
core/src/cats/sql_get.cc
Outdated
{ | ||
db_list_ctx deleted_jobids; | ||
std::string query{ | ||
"DELETE FROM Job where (JobFiles=0 OR PurgedFiles=1) AND JobID in ("}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, just doing an SQL DELETE
will potentially leave stale records in tables JobMedia, Log, basefiles, PathVisibility, NDMPJobEnvironment, JobStats and RestoreObject.
core/src/cats/sql_get.cc
Outdated
if (!SqlQueryWithHandler(query.c_str(), DbDeleteListHandler, | ||
&deleted_jobids)) { | ||
Jmsg(jcr, M_ERROR, 0, | ||
"Deleting jobids with no files from list %s failed : ERR=%s\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be "Purging" instead of "Deleting"?
core/src/cats/sql_get.cc
Outdated
{ | ||
db_list_ctx deleted_jobids; | ||
std::string query{ | ||
"DELETE FROM Job where (JobFiles=0 OR PurgedFiles=1) AND JobID in ("}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need to determine the list and then do whatever"delete jobid=XXX" would be doing.
e044bb8
to
3327e62
Compare
in case of PGRES_FATAL_ERROR
Verify that empty jobs are purged before consolidation starts.
This patch refactors functions to purge files and jobs and to upgrade copy jobs to backup jobs so they can be called without an UaContext.
Previously empty jobs (i.e. those with JobFiles == 0) were left untouched by consolidation. This change now adds functionality that will identify these jobs and purge them so the result looks like they had been consolidated, too.
3327e62
to
c6306fa
Compare
4a167a4
to
538697d
Compare
Thank you for contributing to the Bareos Project!
The consolidation job now purges jobs without files from the jobid list before starting the consolidation. This makes sure that jobs without are cleaned up before and consolidation of jobs that do not have any files is never tried.
Also, the current postgresql query code reacts to an PGRES_FATAL_ERROR either by exiting the daemon (if exit on fatal is set) or by simply returning a normal error returning the error string from the database.
Please check
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
Source code quality
bareos-check-sources --since-merge
does not report any problemsgit status
should not report modifications in the source tree after building and testingTests