]> git.sur5r.net Git - bacula/bacula/commitdiff
Sort bsr on JobMediaId
authorKern Sibbald <kern@sibbald.com>
Fri, 23 May 2003 22:04:09 +0000 (22:04 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 23 May 2003 22:04:09 +0000 (22:04 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@536 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/cats/cats.h
bacula/src/cats/sql_get.c
bacula/src/dird/ua_restore.c

index 8d9fc909a74a95c9585b11c09d7dd3ffb1b591c2..5661ab6c5c09b2be14a70a47db46edbe5f7057f4 100644 (file)
@@ -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:
index 6e5ab105ff6f624ed428d1b61d661dcf9f443bf2..5a0f51fb9ffbca82f2318c5ffb43e050182a8edf 100644 (file)
@@ -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 */
index a9aefa16c48fd915242ebc649f9edb4e16ceb142..f7bcd82fd6b5c901820696cb5558dbf928ccf43c 100644 (file)
@@ -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;
       }
index 0f7491531f02c39a13b7e44eaeeb41f2bccf34a0..336ce194904845475ae927da630af1b0f22f422a 100644 (file)
@@ -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);
       }