2 This patch try to cleanup MaxConcurrent checks from director
8 ===================================================================
9 --- src/dird/jobq.c (révision 6325)
10 +++ src/dird/jobq.c (copie de travail)
12 * put into the ready queue.
14 if (jcr->acquired_resource_locks) {
16 - jcr->rstore->NumConcurrentJobs = 0;
17 - Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
20 - jcr->wstore->NumConcurrentJobs--;
21 - Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
23 +// if (jcr->rstore) {
24 +// jcr->rstore->NumConcurrentJobs = 0;
25 +// Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
27 +// if (jcr->wstore) {
28 +// jcr->wstore->NumConcurrentJobs--;
29 +// Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
31 jcr->client->NumConcurrentJobs--;
32 jcr->job->NumConcurrentJobs--;
33 jcr->acquired_resource_locks = false;
36 static bool acquire_resources(JCR *jcr)
38 - bool skip_this_jcr = false;
40 - jcr->acquired_resource_locks = false;
42 - Dmsg1(200, "Rstore=%s\n", jcr->rstore->name());
44 - * Let only one Restore/Verify job run at a time regardless
45 - * of MaxConcurrentjobs.
47 - if (jcr->rstore->NumConcurrentJobs == 0) {
48 - jcr->rstore->NumConcurrentJobs = 1;
49 - Dmsg0(200, "Set rncj=1\n");
51 - Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs);
52 - set_jcr_job_status(jcr, JS_WaitStoreRes);
58 - Dmsg1(200, "Wstore=%s\n", jcr->wstore->name());
59 - if (jcr->rstore == jcr->wstore) { /* deadlock */
60 - jcr->rstore->NumConcurrentJobs = 0; /* back out rstore */
61 - Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
62 - " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
63 - jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
64 - set_jcr_job_status(jcr, JS_Canceled);
67 - if (jcr->wstore->NumConcurrentJobs == 0 &&
68 - jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
69 - /* Simple case, first job */
70 - jcr->wstore->NumConcurrentJobs = 1;
71 - Dmsg0(200, "Set wncj=1\n");
72 - } else if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
73 - jcr->wstore->NumConcurrentJobs++;
74 - Dmsg1(200, "Inc wncj=%d\n", jcr->wstore->NumConcurrentJobs);
75 - } else if (jcr->rstore) {
76 - jcr->rstore->NumConcurrentJobs = 0; /* back out rstore */
77 - Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
78 - skip_this_jcr = true;
80 - Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
81 - skip_this_jcr = true;
84 - if (skip_this_jcr) {
85 - set_jcr_job_status(jcr, JS_WaitStoreRes);
89 +// bool skip_this_jcr = false;
91 +// jcr->acquired_resource_locks = false;
92 +// if (jcr->rstore) {
93 +// Dmsg1(200, "Rstore=%s\n", jcr->rstore->name());
95 +// * Let only one Restore/Verify job run at a time regardless
96 +// * of MaxConcurrentjobs.
98 +// if (jcr->rstore->NumConcurrentJobs == 0) {
99 +// jcr->rstore->NumConcurrentJobs = 1;
100 +// Dmsg0(200, "Set rncj=1\n");
102 +// Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs);
103 +// set_jcr_job_status(jcr, JS_WaitStoreRes);
108 +// if (jcr->wstore) {
109 +// Dmsg1(200, "Wstore=%s\n", jcr->wstore->name());
110 +// if (jcr->rstore == jcr->wstore) { /* deadlock */
111 +// jcr->rstore->NumConcurrentJobs = 0; /* back out rstore */
112 +// Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
113 +// " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
114 +// jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
115 +// set_jcr_job_status(jcr, JS_Canceled);
118 +// if (jcr->wstore->NumConcurrentJobs == 0 &&
119 +// jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
120 +// /* Simple case, first job */
121 +// jcr->wstore->NumConcurrentJobs = 1;
122 +// Dmsg0(200, "Set wncj=1\n");
123 +// } else if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
124 +// jcr->wstore->NumConcurrentJobs++;
125 +// Dmsg1(200, "Inc wncj=%d\n", jcr->wstore->NumConcurrentJobs);
126 +// } else if (jcr->rstore) {
127 +// jcr->rstore->NumConcurrentJobs = 0; /* back out rstore */
128 +// Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
129 +// skip_this_jcr = true;
131 +// Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
132 +// skip_this_jcr = true;
135 +// if (skip_this_jcr) {
136 +// set_jcr_job_status(jcr, JS_WaitStoreRes);
140 if (jcr->client->NumConcurrentJobs < jcr->client->MaxConcurrentJobs) {
141 jcr->client->NumConcurrentJobs++;
143 - /* Back out previous locks */
145 - jcr->wstore->NumConcurrentJobs--;
146 - Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
149 - jcr->rstore->NumConcurrentJobs = 0;
150 - Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
152 +// /* Back out previous locks */
153 +// if (jcr->wstore) {
154 +// jcr->wstore->NumConcurrentJobs--;
155 +// Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
157 +// if (jcr->rstore) {
158 +// jcr->rstore->NumConcurrentJobs = 0;
159 +// Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
161 set_jcr_job_status(jcr, JS_WaitClientRes);
164 @@ -748,14 +748,14 @@
165 jcr->job->NumConcurrentJobs++;
167 /* Back out previous locks */
169 - jcr->wstore->NumConcurrentJobs--;
170 - Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
173 - jcr->rstore->NumConcurrentJobs = 0;
174 - Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
176 +// if (jcr->wstore) {
177 +// jcr->wstore->NumConcurrentJobs--;
178 +// Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
180 +// if (jcr->rstore) {
181 +// jcr->rstore->NumConcurrentJobs = 0;
182 +// Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
184 jcr->client->NumConcurrentJobs--;
185 set_jcr_job_status(jcr, JS_WaitJobRes);