X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fappend.c;h=9910ce1c0e54584170d2a431a9b441c830839dee;hb=b22b260eaa7fb9f122523fff0e324dca5904b97f;hp=1e5153e01923f62382b3733d666de22e6e1e24b7;hpb=8f69ad5abe548325e09863bb023c596e9a947f3f;p=bacula%2Fbacula diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index 1e5153e019..9910ce1c0e 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -43,6 +43,7 @@ bool do_append_data(JCR *jcr) char buf1[100], buf2[100]; DCR *dcr = jcr->dcr; DEVICE *dev; + char ec[50]; if (!dcr) { @@ -69,6 +70,7 @@ bool do_append_data(JCR *jcr) if (!acquire_device_for_append(dcr)) { set_jcr_job_status(jcr, JS_ErrorTerminated); + jcr->dcr = NULL; return false; } @@ -78,7 +80,7 @@ bool do_append_data(JCR *jcr) if (dev->VolCatInfo.VolCatName[0] == 0) { Pmsg0(000, _("NULL Volume name. This shouldn't happen!!!\n")); } - Dmsg1(20, "Begin append device=%s\n", dev->print_name()); + Dmsg1(50, "Begin append device=%s\n", dev->print_name()); begin_data_spool(dcr); begin_attribute_spool(jcr); @@ -92,7 +94,7 @@ bool do_append_data(JCR *jcr) */ if (!write_session_label(dcr, SOS_LABEL)) { Jmsg1(jcr, M_FATAL, 0, _("Write session label failed. ERR=%s\n"), - strerror_dev(dev)); + dev->bstrerror()); set_jcr_job_status(jcr, JS_ErrorTerminated); ok = false; } @@ -202,9 +204,9 @@ bool do_append_data(JCR *jcr) rec.remainder); if (!write_block_to_device(dcr)) { Dmsg2(90, "Got write_block_to_dev error on device %s. %s\n", - dev->print_name(), strerror_dev(dev)); + dev->print_name(), dev->bstrerror()); Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"), - dev->print_name(), strerror_dev(dev)); + dev->print_name(), dev->bstrerror()); ok = false; break; } @@ -239,6 +241,7 @@ bool do_append_data(JCR *jcr) Dmsg0(650, "Enter bnet_get\n"); } Dmsg1(650, "End read loop with FD. Stat=%d\n", n); + if (is_bnet_error(ds)) { Dmsg1(350, "Network read error from FD. ERR=%s\n", bnet_strerror(ds)); Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"), @@ -248,13 +251,20 @@ bool do_append_data(JCR *jcr) } } + time_t job_elapsed = time(NULL) - jcr->run_time; + + if (job_elapsed <= 0) { + job_elapsed = 1; + } + + Jmsg(dcr->jcr, M_INFO, 0, _("Job write elapsed time = %02d:%02d:%02d, Transfer rate = %s bytes/second\n"), + job_elapsed / 3600, job_elapsed % 3600 / 60, job_elapsed % 60, + edit_uint64_with_suffix(jcr->JobBytes / job_elapsed, ec)); + /* Create Job status for end of session label */ set_jcr_job_status(jcr, ok?JS_Terminated:JS_ErrorTerminated); - Dmsg1(200, "Write session label JobStatus=%d\n", jcr->JobStatus); - if ((!ok || job_canceled(jcr)) && dev->VolCatInfo.VolCatName[0] == 0) { - Pmsg0(000, _("NULL Volume name. This shouldn't happen!!!\n")); - } + Dmsg1(200, "Write EOS label JobStatus=%c\n", jcr->JobStatus); /* * If !OK, check if we can still write. This may not be the case @@ -263,7 +273,7 @@ bool do_append_data(JCR *jcr) if (ok || dev->can_write()) { if (!write_session_label(dcr, EOS_LABEL)) { Jmsg1(jcr, M_FATAL, 0, _("Error writting end session label. ERR=%s\n"), - strerror_dev(dev)); + dev->bstrerror()); set_jcr_job_status(jcr, JS_ErrorTerminated); ok = false; } @@ -274,7 +284,7 @@ bool do_append_data(JCR *jcr) /* Flush out final partial block of this session */ if (!write_block_to_device(dcr)) { Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"), - dev->print_name(), strerror_dev(dev)); + dev->print_name(), dev->bstrerror()); Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n")); ok = false; }