From: Kern Sibbald Date: Fri, 23 May 2003 22:04:09 +0000 (+0000) Subject: Sort bsr on JobMediaId X-Git-Tag: Release-1.31~120 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=00e9b90c321b6270b212aff348f2abd2efc51dca;p=bacula%2Fbacula Sort bsr on JobMediaId git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@536 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 8d9fc909a7..5661ab6c5c 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -25,6 +25,10 @@ Testing to do: (painful) - Figure out how to use ssh or stunnel to protect Bacula communications. For 1.31 release: +- The bsr for Dan's job has file indexes covering the whole range rather + than only the range contained on the volume. +- Don't zero the Slot when the wrong volume is found -- simply ask + the operator. - Add SDWriteSeqNo to SD, and probably Read on FD side. - Make sure all restore counters are working correctly in the FD. - When all cassettes in magazine are used, got: diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 6e5ab105ff..5a0f51fb9f 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -337,6 +337,7 @@ struct JOBMEDIA_DBR { /* Volume Parameter structure */ struct VOL_PARAMS { char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ + uint32_t JobMediaId; /* record id */ uint32_t FirstIndex; /* First index this Volume */ uint32_t LastIndex; /* Last index this Volume */ uint32_t StartFile; /* File for start of data */ diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index a9aefa16c4..f7bcd82fd6 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -278,7 +278,7 @@ FROM Job WHERE JobId=%u", jr->JobId); jr->VolSessionId = str_to_uint64(row[0]); jr->VolSessionTime = str_to_uint64(row[1]); - jr->PoolId = atoi(row[2]); + jr->PoolId = str_to_uint64(row[2]); bstrncpy(jr->cStartTime, row[3]!=NULL?row[3]:"", sizeof(jr->cStartTime)); bstrncpy(jr->cEndTime, row[4]!=NULL?row[4]:"", sizeof(jr->cEndTime)); jr->JobFiles = atol(row[5]); @@ -361,7 +361,8 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAMS db_lock(mdb); Mmsg(&mdb->cmd, -"SELECT VolumeName,FirstIndex,LastIndex,StartFile,EndFile,StartBlock,EndBlock" +"SELECT VolumeName,FirstIndex,LastIndex,StartFile,EndFile,StartBlock," +"EndBlock,JobMediaId" " FROM JobMedia,Media WHERE JobMedia.JobId=%u" " AND JobMedia.MediaId=Media.MediaId", JobId); @@ -391,6 +392,7 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAMS Vols[i].EndFile = atoi(row[4]); Vols[i].StartBlock = atoi(row[5]); Vols[i].EndBlock = atoi(row[6]); + Vols[i].JobMediaId = str_to_uint64(row[7]); } } } @@ -441,7 +443,7 @@ int db_get_pool_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[]) if (*num_ids > 0) { id = (uint32_t *)malloc(*num_ids * sizeof(uint32_t)); while ((row = sql_fetch_row(mdb)) != NULL) { - id[i++] = (uint32_t)atoi(row[0]); + id[i++] = str_to_uint64(row[0]); } *ids = id; } diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 0f7491531f..336ce19490 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -60,7 +60,7 @@ struct JOBIDS { utime_t JobTDate; uint32_t TotalFiles; char ClientName[MAX_NAME_LENGTH]; - char JobIds[200]; + char JobIds[200]; /* User entered string of JobIds */ STORE *store; }; @@ -763,14 +763,17 @@ static int write_bsr_file(UAContext *ua, RBSR *bsr) return stat; } +/* + * ***FIXME*** we need a better volume sequence number + */ int comp_vol_params(const void *v1, const void *v2) { VOL_PARAMS *vol1 = (VOL_PARAMS *)v1; VOL_PARAMS *vol2 = (VOL_PARAMS *)v2; - if (vol1->FirstIndex < vol2->FirstIndex) { + if (vol1->JobMediaId < vol2->JobMediaId) { return -1; - } else if (vol1->FirstIndex > vol2->FirstIndex) { + } else if (vol1->JobMediaId > vol2->JobMediaId) { return 1; } else { return 0; @@ -789,7 +792,6 @@ static RBSR *sort_bsr(RBSR *bsr) /* Sort the VolParams for each bsr */ for (RBSR *nbsr=bsr; nbsr; nbsr=nbsr->next) { if (nbsr->VolCount > 1) { - Dmsg1(100, "VolCount=%d\n", nbsr->VolCount); qsort((void *)nbsr->VolParams, nbsr->VolCount, sizeof(VOL_PARAMS), comp_vol_params); }