Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 613a5f2
Author: Andreas Rogge <andreas.rogge@bareos.com>
Date:   Wed Apr 10 12:42:31 2019 +0200

    stored: do not write duplicate SOS during MAC run

    Fixes #1030: bscan does not work for migration and copy jobs

    Previously when running a migrate, copy or virtual full backup the
    resulting volume contained not one but two SOS records. The newly
    generated one and the original one.

    This patch now makes sure that only the newly generated SOS record is
    written to the destination volume.
    This patch also makes sure that the fields job_name, client_name,
    fileset_name and fileset_md5 are written in the new SOS.

commit 88d9197
Author: Andreas Rogge <andreas.rogge@bareos.com>
Date:   Wed Apr 10 12:36:41 2019 +0200

    bscan: fix crash on excessive SOS records

    Previously the bscan utility crashed when it read a volume that
    contained excessive SOS records (i.e. more SOS than EOS records) and was
    asked to sync these to the database.
    This patch fixes that crash so that volumes with broken SOS/EOS can now
    be scanned again.
  • Loading branch information
arogge committed Apr 15, 2019
1 parent c809330 commit ac36392
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/stored/bscan.c
Expand Up @@ -754,8 +754,6 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
if (!db->update_job_end_record(bjcr, &jr)) { if (!db->update_job_end_record(bjcr, &jr)) {
Pmsg1(0, _("Could not update job record. ERR=%s\n"), db->strerror()); Pmsg1(0, _("Could not update job record. ERR=%s\n"), db->strerror());
} }
mjcr->read_dcr = NULL;
free_jcr(mjcr);
} }
} }
mr.VolFiles = rec->File; mr.VolFiles = rec->File;
Expand Down
21 changes: 10 additions & 11 deletions src/stored/mac.c
Expand Up @@ -147,13 +147,16 @@ static bool clone_record_internally(DCR *dcr, DEV_RECORD *rec)


unser_session_label(label, rec); unser_session_label(label, rec);


/* if (jcr->is_JobType(JT_MIGRATE) || jcr->is_JobType(JT_COPY)) {
* set job info from first SOS label bstrncpy(jcr->Job, label->Job, sizeof(jcr->Job));
*/ pm_strcpy(jcr->job_name, label->JobName);
pm_strcpy(jcr->client_name, label->ClientName);
pm_strcpy(jcr->fileset_name, label->FileSetName);
pm_strcpy(jcr->fileset_md5, label->FileSetMD5);
}
jcr->setJobType(label->JobType); jcr->setJobType(label->JobType);
jcr->setJobLevel(label->JobLevel); jcr->setJobLevel(label->JobLevel);
Dmsg1(200, "joblevel from SOS_LABEL is now %c\n", label->JobLevel); Dmsg1(200, "joblevel from SOS_LABEL is now %c\n", label->JobLevel);
bstrncpy(jcr->Job, label->Job, sizeof(jcr->Job));


if (label->VerNum >= 11) { if (label->VerNum >= 11) {
jcr->sched_time = btime_to_unix(label->write_btime); jcr->sched_time = btime_to_unix(label->write_btime);
Expand All @@ -177,15 +180,11 @@ static bool clone_record_internally(DCR *dcr, DEV_RECORD *rec)
} }
} else { } else {
Dmsg0(200, "Found additional SOS_LABEL, ignoring! \n"); Dmsg0(200, "Found additional SOS_LABEL, ignoring! \n");
retval = true;
goto bail_out;
} }

} else {
/* Other label than SOS -> skip */
retval = true;
goto bail_out;
} }
/* Other label than SOS -> skip */
retval = true;
goto bail_out;
} }


/* /*
Expand Down

0 comments on commit ac36392

Please sign in to comment.