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.0.1~58 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=debe8620430868a0d0596d27aa20f8ba13061157;p=bacula%2Fbacula Make dup jobs regress test work --- diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index efd663ba4a..857ac31b59 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -449,7 +449,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); } @@ -500,6 +505,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); @@ -762,11 +776,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 a39f680806..ad0a0dece6 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -317,7 +317,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); }