From: Eric Bollengier Date: Mon, 11 May 2020 15:16:26 +0000 (+0200) Subject: BEE Backport bacula/src/cats/sql_update.c X-Git-Tag: Release-11.3.2~1704 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f00490f825153d7c67aebbddf77b8c3545ee53b;p=thirdparty%2Fbacula.git BEE Backport bacula/src/cats/sql_update.c This commit is the result of the squash of the following main commits: Author: Eric Bollengier Date: Tue Feb 27 16:06:06 2018 +0100 Allow to copy/migrate jobs with plugins Up to now, the unique Job name is used by plugins as a key in some cases (for example as a snapshot name). The plugin can use this value to compute the backup set. For example, snapshot-diff previous current When using Copy/Migration, the unique Job name associated with a job is updated with a new name, leading to some confusion on the plugin side. With this patch, we associate the original Job name with the Copy/Migration job record in the catalog, and we can send this value to the Client. If we copy a job that was migrated, the original job is kept from one job record to an other. Author: Eric Bollengier Date: Tue Feb 13 14:15:04 2018 +0100 Add MaxPoolBytes support for SQL functions --- diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 49ed5a7076..183cad2a1c 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -20,6 +20,7 @@ * Bacula Catalog Database Update record interface routines * * Written by Kern Sibbald, March 2000 + * */ #include "bacula.h" @@ -179,12 +180,12 @@ int BDB::bdb_update_job_end_record(JCR *jcr, JOB_DBR *jr) "UPDATE Job SET JobStatus='%c',EndTime='%s'," "ClientId=%u,JobBytes=%s,ReadBytes=%s,JobFiles=%u,JobErrors=%u,VolSessionId=%u," "VolSessionTime=%u,PoolId=%u,FileSetId=%u,JobTDate=%s," -"RealEndTime='%s',PriorJobId=%s,HasBase=%u,PurgedFiles=%u WHERE JobId=%s", +"RealEndTime='%s',PriorJobId=%s,HasBase=%u,PurgedFiles=%u,PriorJob='%s' WHERE JobId=%s", (char)(jr->JobStatus), dt, jr->ClientId, edit_uint64(jr->JobBytes, ed1), edit_uint64(jr->ReadBytes, ed4), jr->JobFiles, jr->JobErrors, jr->VolSessionId, jr->VolSessionTime, jr->PoolId, jr->FileSetId, edit_uint64(JobTDate, ed2), - rdt, PriorJobId, jr->HasBase, jr->PurgedFiles, + rdt, PriorJobId, jr->HasBase, jr->PurgedFiles, jr->PriorJob, edit_int64(jr->JobId, ed3)); stat = UpdateDB(jcr, cmd, false); @@ -253,7 +254,7 @@ int BDB::bdb_update_counter_record(JCR *jcr, COUNTER_DBR *cr) int BDB::bdb_update_pool_record(JCR *jcr, POOL_DBR *pr) { int stat; - char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50]; + char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50], ed6[50], ed7[50], ed8[50]; char esc[MAX_ESCAPE_NAME_LENGTH]; bdb_lock(); @@ -269,7 +270,7 @@ int BDB::bdb_update_pool_record(JCR *jcr, POOL_DBR *pr) "AcceptAnyVolume=%d,VolRetention='%s',VolUseDuration='%s'," "MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s,Recycle=%d," "AutoPrune=%d,LabelType=%d,LabelFormat='%s',RecyclePoolId=%s," -"ScratchPoolId=%s,ActionOnPurge=%d,CacheRetention='%s' WHERE PoolId=%s", +"ScratchPoolId=%s,ActionOnPurge=%d,CacheRetention='%s',MaxPoolBytes='%s' WHERE PoolId=%s", pr->NumVols, pr->MaxVols, pr->UseOnce, pr->UseCatalog, pr->AcceptAnyVolume, edit_uint64(pr->VolRetention, ed1), edit_uint64(pr->VolUseDuration, ed2), @@ -280,6 +281,7 @@ int BDB::bdb_update_pool_record(JCR *jcr, POOL_DBR *pr) edit_int64(pr->ScratchPoolId,ed6), pr->ActionOnPurge, edit_uint64(pr->CacheRetention, ed7), + edit_uint64(pr->MaxPoolBytes, ed8), ed4); stat = UpdateDB(jcr, cmd, false); bdb_unlock();