From: Kern Sibbald Date: Tue, 16 Feb 2010 12:59:47 +0000 (+0100) Subject: Make dup jobs regress test work X-Git-Tag: Release-5.2.1~1723 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=271c746ff5f035cb1ec6a28697f9289ed5dbcd86;p=bacula%2Fbacula Make dup jobs regress test work --- diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 80e8744c87..36308e8f38 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -452,7 +452,12 @@ bool cancel_job(UAContext *ua, JCR *jcr) sd->signal(BNET_TERMINATE); sd->close(); ua->jcr->store_bsock = NULL; + jcr->store_bsock->set_timed_out(); jcr->store_bsock->set_terminated(); + if (jcr->SD_msg_chan) { + Dmsg2(400, "kill jobid=%d use=%d\n", (int)jcr->JobId, jcr->use_count()); + pthread_kill(jcr->SD_msg_chan, TIMEOUT_SIGNAL); + } if (jcr->my_thread_id) { pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL); } @@ -503,6 +508,15 @@ void cancel_storage_daemon_job(JCR *jcr) sd->close(); ua->jcr->store_bsock = NULL; jcr->sd_canceled = true; + jcr->store_bsock->set_timed_out(); + jcr->store_bsock->set_terminated(); + if (jcr->SD_msg_chan) { + Dmsg2(400, "kill jobid=%d use=%d\n", (int)jcr->JobId, jcr->use_count()); + pthread_kill(jcr->SD_msg_chan, TIMEOUT_SIGNAL); + } + if (jcr->my_thread_id) { + pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL); + } } bail_out: free_jcr(control_jcr); @@ -765,11 +779,9 @@ bool allow_duplicate_job(JCR *jcr) UAContext *ua = new_ua_context(jcr); Jmsg(jcr, M_INFO, 0, _("Cancelling duplicate JobId=%d.\n"), djcr->JobId); cancel_job(ua, djcr); + bmicrosleep(0, 500000); + cancel_job(ua, djcr); free_ua_context(ua); - if (djcr->my_thread_id) { - pthread_kill(djcr->my_thread_id, TIMEOUT_SIGNAL); - Dmsg1(800, "Send kill to jid=%d\n", djcr->JobId); - } Dmsg2(800, "Cancel dup %p JobId=%d\n", djcr, djcr->JobId); } else { /* Zap current job */ diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 918414cef1..5ee4d6756f 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -326,7 +326,6 @@ static bool cancel_cmd(JCR *cjcr) Dmsg2(800, "Term bsock jid=%d %p\n", jcr->JobId, jcr); } else { /* Still waiting for FD to connect, release it */ - bmicrosleep(0, 50000); pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */ Dmsg2(800, "Signal FD connect jid=%d %p\n", jcr->JobId, jcr); }