Skip to content

Commit

Permalink
Merge branch 'bareos-15.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed May 13, 2016
2 parents 050a702 + dbddf5b commit a2fe95c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 30 deletions.
4 changes: 3 additions & 1 deletion src/dird/scheduler.c
Expand Up @@ -188,7 +188,9 @@ JCR *wait_for_next_job(char *one_shot_job_to_run)

free(next_job);

if (!job->enabled || (job->client && !job->client->enabled)) {
if (!job->enabled ||
(job->schedule && !job->schedule->enabled) ||
(job->client && !job->client->enabled)) {
free_jcr(jcr);
goto again; /* ignore this job */
}
Expand Down
2 changes: 1 addition & 1 deletion src/dird/ua_output.c
Expand Up @@ -169,7 +169,7 @@ static void show_disabled_schedules(UAContext *ua)
if (!sched->enabled) {
if (first) {
first = false;
ua->send_msg(_("Disabled Scedules:\n"));
ua->send_msg(_("Disabled Schedules:\n"));
}
ua->send_msg(" %s\n", sched->name());
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/util.c
Expand Up @@ -773,6 +773,7 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
{
char *p, *q;
const char *str;
char ed1[50];
char add[50];
char name[MAX_NAME_LENGTH];
int i;
Expand All @@ -786,7 +787,8 @@ POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to, job_co
str = "%";
break;
case 'B': /* Job Bytes in human readable format */
str = edit_uint64_with_suffix(jcr->JobBytes, add);
bsnprintf(add, sizeof(add), "%sB", edit_uint64_with_suffix(jcr->JobBytes, ed1));
str = add;
break;
case 'F': /* Job Files */
str = edit_uint64(jcr->JobFiles, add);
Expand Down
64 changes: 37 additions & 27 deletions src/lmdb/mdb.c
Expand Up @@ -6425,11 +6425,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
MDB_node *leaf;
int rc;

if (mc->mc_flags & C_EOF) {
if ((mc->mc_flags & C_EOF) ||
((mc->mc_flags & C_DEL) && op == MDB_NEXT_DUP)) {
return MDB_NOTFOUND;
}

mdb_cassert(mc, mc->mc_flags & C_INITIALIZED);
if (!(mc->mc_flags & C_INITIALIZED))
return mdb_cursor_first(mc, key, data);

mp = mc->mc_pg[mc->mc_top];

Expand Down Expand Up @@ -6515,7 +6516,12 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
MDB_node *leaf;
int rc;

mdb_cassert(mc, mc->mc_flags & C_INITIALIZED);
if (!(mc->mc_flags & C_INITIALIZED)) {
rc = mdb_cursor_last(mc, key, data);
if (rc)
return rc;
mc->mc_ki[mc->mc_top]++;
}

mp = mc->mc_pg[mc->mc_top];

Expand Down Expand Up @@ -6987,10 +6993,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data,
rc = MDB_INCOMPATIBLE;
break;
}
if (!(mc->mc_flags & C_INITIALIZED))
rc = mdb_cursor_first(mc, key, data);
else
rc = mdb_cursor_next(mc, key, data, MDB_NEXT_DUP);
rc = mdb_cursor_next(mc, key, data, MDB_NEXT_DUP);
if (rc == MDB_SUCCESS) {
if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) {
MDB_cursor *mx;
Expand Down Expand Up @@ -7032,21 +7035,11 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data,
case MDB_NEXT:
case MDB_NEXT_DUP:
case MDB_NEXT_NODUP:
if (!(mc->mc_flags & C_INITIALIZED))
rc = mdb_cursor_first(mc, key, data);
else
rc = mdb_cursor_next(mc, key, data, op);
rc = mdb_cursor_next(mc, key, data, op);
break;
case MDB_PREV:
case MDB_PREV_DUP:
case MDB_PREV_NODUP:
if (!(mc->mc_flags & C_INITIALIZED)) {
rc = mdb_cursor_last(mc, key, data);
if (rc)
break;
mc->mc_flags |= C_INITIALIZED;
mc->mc_ki[mc->mc_top]++;
}
rc = mdb_cursor_prev(mc, key, data, op);
break;
case MDB_FIRST:
Expand Down Expand Up @@ -9058,8 +9051,6 @@ mdb_cursor_del0(MDB_cursor *mc)
if (m3->mc_pg[mc->mc_top] == mp) {
if (m3->mc_ki[mc->mc_top] == ki) {
m3->mc_flags |= C_DEL;
if (mc->mc_db->md_flags & MDB_DUPSORT)
m3->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED;
} else if (m3->mc_ki[mc->mc_top] > ki) {
m3->mc_ki[mc->mc_top]--;
}
Expand Down Expand Up @@ -9093,11 +9084,21 @@ mdb_cursor_del0(MDB_cursor *mc)
continue;
if (m3->mc_pg[mc->mc_top] == mp) {
/* if m3 points past last node in page, find next sibling */
if (m3->mc_ki[mc->mc_top] >= nkeys) {
rc = mdb_cursor_sibling(m3, 1);
if (rc == MDB_NOTFOUND) {
m3->mc_flags |= C_EOF;
rc = MDB_SUCCESS;
if (m3->mc_ki[mc->mc_top] >= mc->mc_ki[mc->mc_top]) {
if (m3->mc_ki[mc->mc_top] >= nkeys) {
rc = mdb_cursor_sibling(m3, 1);
if (rc == MDB_NOTFOUND) {
m3->mc_flags |= C_EOF;
rc = MDB_SUCCESS;
continue;
}
}
if (mc->mc_db->md_flags & MDB_DUPSORT) {
MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]);
if (node->mn_flags & F_DUPDATA) {
mdb_xcursor_init1(m3, node);
m3->mc_xcursor->mx_cursor.mc_flags |= C_DEL;
}
}
}
}
Expand Down Expand Up @@ -10509,8 +10510,11 @@ mdb_drop0(MDB_cursor *mc, int subs)

/* DUPSORT sub-DBs have no ovpages/DBs. Omit scanning leaves.
* This also avoids any P_LEAF2 pages, which have no nodes.
* Also if the DB doesn't have sub-DBs and has no overflow
* pages, omit scanning leaves.
*/
if (mc->mc_flags & C_SUB)
if ((mc->mc_flags & C_SUB) ||
(!subs && !mc->mc_db->md_overflow_pages))
mdb_cursor_pop(mc);

mdb_cursor_copy(mc, &mx);
Expand All @@ -10537,13 +10541,18 @@ mdb_drop0(MDB_cursor *mc, int subs)
pg, omp->mp_pages);
if (rc)
goto done;
mc->mc_db->md_overflow_pages -= omp->mp_pages;
if (!mc->mc_db->md_overflow_pages && !subs)
break;
} else if (subs && (ni->mn_flags & F_SUBDATA)) {
mdb_xcursor_init1(mc, ni);
rc = mdb_drop0(&mc->mc_xcursor->mx_cursor, 0);
if (rc)
goto done;
}
}
if (!subs && !mc->mc_db->md_overflow_pages)
goto pop;
} else {
if ((rc = mdb_midl_need(&txn->mt_free_pgs, n)) != 0)
goto done;
Expand All @@ -10565,6 +10574,7 @@ mdb_drop0(MDB_cursor *mc, int subs)
/* no more siblings, go back to beginning
* of previous level.
*/
pop:
mdb_cursor_pop(mc);
mc->mc_ki[0] = 0;
for (i=1; i<mc->mc_snum; i++) {
Expand Down

0 comments on commit a2fe95c

Please sign in to comment.