From: Eric Bollengier Date: Fri, 12 Aug 2022 08:45:24 +0000 (+0200) Subject: Move some common code to update_job_end_record() X-Git-Tag: Beta-15.0.0~458 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1b8f52029fad1aa9695929c740b4a508768820a;p=thirdparty%2Fbacula.git Move some common code to update_job_end_record() --- diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index d88bf0a4f..61496fab7 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -94,7 +94,7 @@ bool do_backup_init(JCR *jcr) jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->name()); if (jcr->jr.PoolId == 0) { Dmsg1(100, "JobId=%d no PoolId\n", (int)jcr->JobId); - Jmsg(jcr, M_FATAL, 0, _("Could not get or create a Pool record.\n")); + Jmsg(jcr, M_FATAL, 0, _("[DE0008] Could not get or create a Pool record.\n")); return false; } @@ -316,19 +316,19 @@ bool send_accurate_current_files(JCR *jcr) jcr->file_bsock->fsend("accurate files=%s\n", nb.list); if (!db_open_batch_connection(jcr, jcr->db)) { - Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connection"); + Jmsg0(jcr, M_FATAL, 0, "[DE0008] Can't get batch sql connection"); return false; /* Fail */ } if (jcr->HasBase) { jcr->nb_base_files = str_to_int64(nb.list); if (!db_create_base_file_list(jcr, jcr->db, jobids.list)) { - Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg1(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } if (!db_get_base_file_list(jcr, jcr->db, jcr->use_accurate_chksum, accurate_list_handler, (void *)jcr)) { - Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg1(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } @@ -337,7 +337,7 @@ bool send_accurate_current_files(JCR *jcr) if (!db_get_file_list(jcr, jcr->db_batch, jobids.list, opts, accurate_list_handler, (void *)jcr)) { - Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db_batch)); + Jmsg1(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db_batch)); return false; } } @@ -481,7 +481,7 @@ bool do_backup(JCR *jcr) jcr->setJobStatus(JS_Running); Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel); if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } @@ -493,17 +493,17 @@ bool do_backup(JCR *jcr) Jmsg(jcr, M_INFO, 0, _("Found %ld files from prior incomplete Job.\n"), (int32_t)job.value); } else { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } Mmsg(buf, "SELECT max(LastIndex) FROM JobMedia WHERE JobId=%s", ed1); if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &last)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } Mmsg(buf, "SELECT max(FirstIndex) FROM JobMedia WHERE JobId=%s", ed1); if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &first)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } /* We skip the last FileIndex (MAX) and the one after (MAX+1), can be @@ -514,13 +514,13 @@ bool do_backup(JCR *jcr) Dmsg1(100, "==== FI=%ld\n", jcr->JobFiles); Mmsg(buf, "SELECT VolSessionId FROM Job WHERE JobId=%s", ed1); if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } jcr->VolSessionId = job.value; Mmsg(buf, "SELECT VolSessionTime FROM Job WHERE JobId=%s", ed1); if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return false; } jcr->VolSessionTime = job.value; @@ -720,7 +720,7 @@ bool do_backup(JCR *jcr) jcr->start_time = time(NULL); jcr->jr.StartTime = jcr->start_time; if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); } /* @@ -905,7 +905,7 @@ void incomplete_cleanup(JCR *jcr) /* Get the last valid FileIndex */ Mmsg(buf, "SELECT max(FileIndex) FROM File WHERE JobId=%s", ed1); if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return; } @@ -914,7 +914,7 @@ void incomplete_cleanup(JCR *jcr) "AND (FirstIndex > %lld OR LastIndex > %lld)", ed1, job.value, job.value); if (!db_sql_query(jcr->db, buf.c_str(), db_string_list_handler, &pids)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); return; } /* Nothing to fix */ @@ -965,7 +965,7 @@ void incomplete_cleanup(JCR *jcr) bail_out: if (!ok) { db_sql_query(jcr->db, "ROLLBACK", NULL, NULL); - Jmsg(jcr, M_FATAL, 0, _("Unable to cleanup JobMedia records\n")); + Jmsg(jcr, M_FATAL, 0, _("[DE0008] Unable to cleanup JobMedia records\n")); } db_end_transaction(jcr, jcr->db); db_unlock(jcr->db); @@ -979,17 +979,16 @@ void backup_cleanup(JCR *jcr, int TermCode) char sdt[50], edt[50], schedt[50], edl[50]; char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30]; char ec6[30], ec7[30], ec8[30], ec9[30], ec10[30], elapsed[50]; - char data_compress[200], comm_compress[200]; + char comm_compress[200], data_compress[200]; char fd_term_msg[100], sd_term_msg[100]; POOL_MEM term_msg; int msg_type = M_INFO; MEDIA_DBR mr; CLIENT_DBR cr; - double kbps, compression, ratio; - utime_t RunTime; POOL_MEM base_info; POOL_MEM vol_info; STORE *wstore = jcr->store_mngr->get_wstore(); + *comm_compress = *data_compress = 0; remove_dummy_jobmedia_records(jcr); @@ -1084,11 +1083,6 @@ void backup_cleanup(JCR *jcr, int TermCode) bstrftimes_na(schedt, sizeof(schedt), jcr->jr.SchedTime); bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime); - RunTime = jcr->jr.EndTime - jcr->jr.StartTime; - if (jcr->jr.StartTime == 0 || RunTime <= 0) { - RunTime = 1; - } - kbps = ((double)jcr->jr.JobBytes) / (1000.0 * (double)RunTime); if (!db_get_job_volume_names(jcr, jcr->db, jcr->jr.JobId, &jcr->VolumeName)) { /* * Note, if the job has erred, most likely it did not write any @@ -1101,31 +1095,28 @@ void backup_cleanup(JCR *jcr, int TermCode) } jcr->VolumeName[0] = 0; /* none */ } - if (jcr->ReadBytes == 0) { bstrncpy(data_compress, "None", sizeof(data_compress)); } else { - compression = (double)100 - 100.0 * ((double)jcr->SDJobBytes / (double)jcr->ReadBytes); - if (compression < 0.5) { + if (jcr->jr.CompressRatio < 0.5) { bstrncpy(data_compress, "None", sizeof(data_compress)); } else { + double ratio = 1.0; if (jcr->SDJobBytes > 0) { ratio = (double)jcr->ReadBytes / (double)jcr->SDJobBytes; - } else { - ratio = 1.0; } bsnprintf(data_compress, sizeof(data_compress), "%.1f%% %.1f:1", - compression, ratio); + jcr->jr.CompressRatio, ratio); } } if (jcr->CommBytes == 0 || jcr->CommCompressedBytes == 0) { bstrncpy(comm_compress, "None", sizeof(comm_compress)); } else { - compression = (double)100 - 100.0 * ((double)jcr->CommCompressedBytes / (double)jcr->CommBytes); + double compression = (double)100 - 100.0 * ((double)jcr->CommCompressedBytes / (double)jcr->CommBytes); if (compression < 0.5) { bstrncpy(comm_compress, "None", sizeof(comm_compress)); } else { - ratio = (double)jcr->CommBytes / (double)jcr->CommCompressedBytes; + double ratio = (double)jcr->CommBytes / (double)jcr->CommCompressedBytes; bsnprintf(comm_compress, sizeof(comm_compress), "%.1f%% %.1f:1", compression, ratio); } @@ -1204,7 +1195,7 @@ void backup_cleanup(JCR *jcr, int TermCode) schedt, sdt, edt, - edit_utime(RunTime, elapsed, sizeof(elapsed)), + edit_utime(jcr->jr.RunTime, elapsed, sizeof(elapsed)), jcr->JobPriority, edit_uint64_with_commas(jcr->jr.JobFiles, ec1), edit_uint64_with_commas(jcr->SDJobFiles, ec2), @@ -1212,7 +1203,7 @@ void backup_cleanup(JCR *jcr, int TermCode) edit_uint64_with_suffix(jcr->jr.JobBytes, ec4), edit_uint64_with_commas(jcr->SDJobBytes, ec5), edit_uint64_with_suffix(jcr->SDJobBytes, ec6), - kbps, + jcr->jr.Rate, data_compress, comm_compress, base_info.c_str(), diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 911701597..033a0e230 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -131,7 +131,7 @@ bool setup_job(JCR *jcr) jcr->catalog->disable_batch_insert); if (!jcr->db || !db_open_database(jcr, jcr->db)) { - Jmsg(jcr, M_FATAL, 0, _("Could not open database \"%s\".\n"), + Jmsg(jcr, M_FATAL, 0, _("[DE0008] Could not open database \"%s\".\n"), jcr->catalog->db_name); if (jcr->db) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); @@ -170,7 +170,7 @@ bool setup_job(JCR *jcr) } if (!db_create_job_record(jcr, jcr->db, &jcr->jr)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); goto bail_out; } jcr->JobId = jcr->jr.JobId; @@ -297,7 +297,7 @@ static bool setup_resume_job(JCR *jcr, JOB_DBR *jr) jcr->catalog->mult_db_connections, jcr->catalog->disable_batch_insert); if (!jcr->db || !db_open_database(jcr, jcr->db)) { - Jmsg(jcr, M_FATAL, 0, _("Could not open database \"%s\".\n"), + Jmsg(jcr, M_FATAL, 0, _("[DE0008] Could not open database \"%s\".\n"), jcr->catalog->db_name); if (jcr->db) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); @@ -444,7 +444,7 @@ static void *job_thread(void *arg) } if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); } /* Run any script BeforeJob on dird */ @@ -463,7 +463,7 @@ static void *job_thread(void *arg) jcr->start_time = time(NULL); jcr->jr.StartTime = jcr->start_time; if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { - Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "[DE0008] %s", db_strerror(jcr->db)); } generate_plugin_event(jcr, bDirEventJobRun); @@ -1372,7 +1372,7 @@ bool get_or_create_client_record(JCR *jcr) } pm_strcpy(jcr->client_name, jcr->client->hdr.name); if (!db_create_client_record(jcr, jcr->db, &cr)) { - Jmsg(jcr, M_FATAL, 0, _("Could not create Client record. ERR=%s\n"), + Jmsg(jcr, M_FATAL, 0, _("[DE0008] Could not create Client record. ERR=%s\n"), db_strerror(jcr->db)); return false; } @@ -1436,6 +1436,7 @@ void init_jcr_job_record(JCR *jcr) jcr->jr.JobLevel = jcr->getJobLevel(); jcr->jr.JobStatus = jcr->JobStatus; jcr->jr.JobId = jcr->JobId; + jcr->jr.isVirtualFull = jcr->is_JobLevel(L_VIRTUAL_FULL); bstrncpy(jcr->jr.Name, jcr->job->name(), sizeof(jcr->jr.Name)); bstrncpy(jcr->jr.Job, jcr->Job, sizeof(jcr->jr.Job)); } @@ -1445,6 +1446,7 @@ void init_jcr_job_record(JCR *jcr) */ void update_job_end_record(JCR *jcr) { + JCR *wjcr = jcr->wjcr ? jcr->wjcr : jcr; jcr->jr.EndTime = time(NULL); jcr->end_time = jcr->jr.EndTime; jcr->jr.JobId = jcr->JobId; @@ -1456,6 +1458,29 @@ void update_job_end_record(JCR *jcr) jcr->jr.VolSessionTime = jcr->VolSessionTime; jcr->jr.JobErrors = jcr->JobErrors + jcr->SDErrors; jcr->jr.HasBase = jcr->HasBase; + bstrncpy(jcr->jr.StatusInfo, jcr->StatusInfo, sizeof(jcr->jr.StatusInfo)); + + STORE *wstore = wjcr->store_mngr->get_wstore(); + jcr->jr.WriteStorageId = wstore? wstore->StorageId : 0; + bstrncpy(jcr->jr.WriteDevice, NPRTB(wjcr->write_dev), sizeof(jcr->jr.WriteDevice)); + + STORE *rstore = jcr->store_mngr->get_rstore(); + jcr->jr.LastReadStorageId = rstore? rstore->StorageId : 0; + bstrncpy(jcr->jr.LastReadDevice, NPRTB(jcr->read_dev), sizeof(jcr->jr.LastReadDevice)); + + jcr->jr.RunTime = jcr->jr.EndTime - jcr->jr.StartTime; + if (jcr->jr.StartTime == 0 || jcr->jr.RunTime <= 0) { + jcr->jr.RunTime = 1; + } + + jcr->jr.Rate = ((double)jcr->jr.JobBytes) / (1000.0 * (double)jcr->jr.RunTime); + if (jcr->ReadBytes > 0) { + jcr->jr.CompressRatio = (double)100 - 100.0 * ((double)jcr->SDJobBytes / (double)jcr->ReadBytes); + if (jcr->jr.CompressRatio < 0.5) { + jcr->jr.CompressRatio = 0; + } + } + if (!db_update_job_end_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error updating job record. %s"), db_strerror(jcr->db)); @@ -1733,24 +1758,31 @@ void set_jcr_defaults(JCR *jcr, JOB *job) } if (!jcr->next_vol_list) { jcr->next_vol_list = get_pool_memory(PM_FNAME); + *jcr->next_vol_list = 0; } if (!jcr->fname) { jcr->fname = get_pool_memory(PM_FNAME); + *jcr->fname = 0; } if (!jcr->pool_source) { jcr->pool_source = get_pool_memory(PM_MESSAGE); + *jcr->pool_source = 0; } if (!jcr->next_pool_source) { jcr->next_pool_source = get_pool_memory(PM_MESSAGE); + *jcr->next_pool_source = 0; } if (!jcr->catalog_source) { jcr->catalog_source = get_pool_memory(PM_MESSAGE); + *jcr->catalog_source = 0; } if (!jcr->write_dev) { jcr->write_dev = get_pool_memory(PM_MESSAGE); + *jcr->write_dev = 0; } if (!jcr->read_dev) { jcr->read_dev = get_pool_memory(PM_MESSAGE); + *jcr->read_dev = 0; } jcr->JobPriority = job->Priority; @@ -1959,7 +1991,7 @@ bool flush_file_records(JCR *jcr) if (jcr->cached_attribute) { Dmsg0(400, "Flush last cached attribute.\n"); if (!db_create_attributes_record(jcr, jcr->db, jcr->ar)) { - Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror()); + Jmsg1(jcr, M_FATAL, 0, _("[DE0008] Attribute create error. %s"), jcr->db->bdb_strerror()); } jcr->cached_attribute = false; } diff --git a/bacula/src/dird/mac.c b/bacula/src/dird/mac.c index 271115f71..1c08a59d0 100644 --- a/bacula/src/dird/mac.c +++ b/bacula/src/dird/mac.c @@ -759,8 +759,6 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) POOL_MEM term_msg; int msg_type = M_INFO; MEDIA_DBR mr; - double kbps; - utime_t RunTime; bool goterrors=false; JCR *wjcr = jcr->wjcr; POOL_MEM query(PM_MESSAGE); @@ -963,11 +961,6 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) Mmsg(term_code, term_msg.c_str(), jcr->get_OperationName(), jcr->get_ActionName(0)); bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime); - RunTime = jcr->jr.EndTime - jcr->jr.StartTime; - if (jcr->jr.StartTime == 0 || RunTime <= 0) { - RunTime = 1; - } - kbps = (double)jcr->SDJobBytes / (1000.0 * (double)RunTime); jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); @@ -1036,12 +1029,12 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) jcr->catalog_source, sdt, edt, - edit_utime(RunTime, elapsed, sizeof(elapsed)), + edit_utime(jcr->jr.RunTime, elapsed, sizeof(elapsed)), jcr->JobPriority, edit_uint64_with_commas(jcr->SDJobFiles, ec1), edit_uint64_with_commas(jcr->SDJobBytes, ec2), edit_uint64_with_suffix(jcr->SDJobBytes, ec3), - (float)kbps, + jcr->jr.Rate, wjcr ? wjcr->VolumeName : "", jcr->VolSessionId, jcr->VolSessionTime, diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index 6594cddba..1927eef21 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -594,8 +594,6 @@ void restore_cleanup(JCR *jcr, int TermCode) char term_code[100], fd_term_msg[100], sd_term_msg[100]; const char *term_msg; int msg_type = M_INFO; - double kbps; - utime_t RunTime; Dmsg0(20, "In restore_cleanup\n"); @@ -671,15 +669,6 @@ void restore_cleanup(JCR *jcr, int TermCode) bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime); - RunTime = jcr->jr.EndTime - jcr->jr.StartTime; - if (jcr->jr.StartTime == 0 || RunTime <= 0) { - RunTime = 1; - } - kbps = (double)jcr->jr.JobBytes / (1000.0 * (double)RunTime); - if (kbps < 0.05) { - kbps = 0; - } - get_restore_params(jcr, where, &creplace, NULL); for (int i=0; ReplaceOptions[i].name; i++) { @@ -718,11 +707,11 @@ void restore_cleanup(JCR *jcr, int TermCode) replace, sdt, edt, - edit_utime(RunTime, elapsed, sizeof(elapsed)), + edit_utime(jcr->jr.RunTime, elapsed, sizeof(elapsed)), edit_uint64_with_commas((uint64_t)jcr->ExpectedFiles, ec1), edit_uint64_with_commas((uint64_t)jcr->jr.JobFiles, ec2), edit_uint64_with_commas(jcr->jr.JobBytes, ec3), edit_uint64_with_suffix(jcr->jr.JobBytes, ec4), - (float)kbps, + jcr->jr.Rate, jcr->JobErrors, fd_term_msg, sd_term_msg, diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index c66adab45..5930ad281 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -442,15 +442,13 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n") void vbackup_cleanup(JCR *jcr, int TermCode) { char sdt[50], edt[50], schedt[50]; - char ec1[30], ec3[30], ec4[30], compress[50]; + char ec1[30], ec3[30], ec4[30]; char ec7[30], ec8[30], elapsed[50]; char term_code[100], sd_term_msg[100]; const char *term_msg; int msg_type = M_INFO; MEDIA_DBR mr; CLIENT_DBR cr; - double kbps, compression; - utime_t RunTime; POOL_MEM query(PM_MESSAGE); STORE *wstore = jcr->store_mngr->get_wstore(); @@ -530,11 +528,6 @@ void vbackup_cleanup(JCR *jcr, int TermCode) bstrftimes(schedt, sizeof(schedt), jcr->jr.SchedTime); bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes(edt, sizeof(edt), jcr->jr.EndTime); - RunTime = jcr->jr.EndTime - jcr->jr.StartTime; - if (RunTime <= 0) { - RunTime = 1; - } - kbps = ((double)jcr->jr.JobBytes) / (1000.0 * (double)RunTime); if (!db_get_job_volume_names(jcr, jcr->db, jcr->jr.JobId, &jcr->VolumeName)) { /* * Note, if the job has erred, most likely it did not write any @@ -548,16 +541,6 @@ void vbackup_cleanup(JCR *jcr, int TermCode) jcr->VolumeName[0] = 0; /* none */ } - if (jcr->ReadBytes == 0) { - bstrncpy(compress, "None", sizeof(compress)); - } else { - compression = (double)100 - 100.0 * ((double)jcr->JobBytes / (double)jcr->ReadBytes); - if (compression < 0.5) { - bstrncpy(compress, "None", sizeof(compress)); - } else { - bsnprintf(compress, sizeof(compress), "%.1f %%", compression); - } - } jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); Jmsg(jcr, msg_type, 0, _("%s %s %s (%s):\n" @@ -597,12 +580,12 @@ void vbackup_cleanup(JCR *jcr, int TermCode) schedt, sdt, edt, - edit_utime(RunTime, elapsed, sizeof(elapsed)), + edit_utime(jcr->jr.RunTime, elapsed, sizeof(elapsed)), jcr->JobPriority, edit_uint64_with_commas(jcr->jr.JobFiles, ec1), edit_uint64_with_commas(jcr->jr.JobBytes, ec3), edit_uint64_with_suffix(jcr->jr.JobBytes, ec4), - kbps, + jcr->jr.Rate, jcr->VolumeName, jcr->VolSessionId, jcr->VolSessionTime, diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 1b7adb574..7f8caa1b1 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -471,7 +471,6 @@ void verify_cleanup(JCR *jcr, int TermCode) char term_code[100], fd_term_msg[100], sd_term_msg[100]; const char *term_msg; int msg_type; - utime_t RunTime; const char *Name; // Dmsg1(100, "Enter verify_cleanup() TermCod=%d\n", TermCode); @@ -536,10 +535,7 @@ void verify_cleanup(JCR *jcr, int TermCode) } bstrftimes_na(sdt, sizeof(sdt), jcr->jr.StartTime); bstrftimes_na(edt, sizeof(edt), jcr->jr.EndTime); - RunTime = jcr->jr.EndTime - jcr->jr.StartTime; - if (jcr->jr.StartTime == 0 || RunTime <= 0) { - RunTime = 1; - } + if (jcr->verify_job) { Name = jcr->verify_job->hdr.name; } else { @@ -584,7 +580,7 @@ void verify_cleanup(JCR *jcr, int TermCode) Name, sdt, edt, - edit_utime(RunTime, elapsed, sizeof(elapsed)), + edit_utime(jcr->jr.RunTime, elapsed, sizeof(elapsed)), accurate, edit_uint64_with_commas(jcr->ExpectedFiles, ec1), edit_uint64_with_commas(jcr->JobFiles, ec2), @@ -621,7 +617,7 @@ void verify_cleanup(JCR *jcr, int TermCode) Name, sdt, edt, - edit_utime(RunTime, elapsed, sizeof(elapsed)), + edit_utime(jcr->jr.RunTime, elapsed, sizeof(elapsed)), edit_uint64_with_commas(jcr->JobFiles, ec1), jcr->JobErrors, fd_term_msg,