]> git.sur5r.net Git - bacula/bacula/commitdiff
Use RestoreObject type in Catalog
authorEric Bollengier <eric@baculasystems.com>
Wed, 4 Jan 2012 13:12:21 +0000 (14:12 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:50:22 +0000 (14:50 +0200)
bacula/src/cats/sql_create.c
bacula/src/dird/fd_cmds.c

index 5c8ec87dde62bdb760724abf56f8ae94e2eb1a00..2f0eb5f22278b0fd9c3dcd9aa2674dcf5b2abcf0 100644 (file)
@@ -1211,7 +1211,7 @@ bool db_create_restore_object_record(JCR *jcr, B_DB *mdb, ROBJECT_DBR *ro)
         "VALUES ('%s','%s','%s',%d,%d,%d,%d,%d,%d,%u)",
         mdb->esc_name, esc_plug_name, mdb->esc_obj,
         ro->object_len, ro->object_full_len, ro->object_index, 
-        FT_RESTORE_FIRST, ro->object_compression, ro->FileIndex, ro->JobId);
+        ro->FileType, ro->object_compression, ro->FileIndex, ro->JobId);
 
    ro->RestoreObjectId = sql_insert_autokey_record(mdb, mdb->cmd, NT_("RestoreObject"));
    if (ro->RestoreObjectId == 0) {
index 85e6055343cdd02c13641086f726196c6054a03f..0add6c181ee92e3c022c6c4fbfa43572138d6b17 100644 (file)
@@ -692,9 +692,15 @@ static int restore_object_handler(void *ctx, int num_fields, char **row)
       return 1;
    }
 
-   fd->fsend("restoreobject JobId=%s %s,%s,%s,%s,%s,%s\n",
-      row[0], row[1], row[2], row[3], row[4], row[5], row[6]);
-
+   if (jcr->FDVersion < 5) {    /* Old version without PluginName */
+      fd->fsend("restoreobject JobId=%s %s,%s,%s,%s,%s,%s\n",
+                row[0], row[1], row[2], row[3], row[4], row[5], row[6]);
+   } else {
+      /* bash spaces from PluginName */
+      bash_spaces(row[9]);      
+      fd->fsend("restoreobject JobId=%s %s,%s,%s,%s,%s,%s,%s\n",
+                row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[9]);
+   }
    Dmsg1(010, "Send obj hdr=%s", fd->msg);
 
    fd->msglen = pm_strcpy(fd->msg, row[7]);
@@ -725,6 +731,7 @@ static int restore_object_handler(void *ctx, int num_fields, char **row)
 
 bool send_restore_objects(JCR *jcr)
 {
+   char ed1[50];
    POOL_MEM query(PM_MESSAGE);
    BSOCK *fd;
    OBJ_CTX octx;
@@ -734,14 +741,16 @@ bool send_restore_objects(JCR *jcr)
    }
    octx.jcr = jcr;
    octx.count = 0;
-   Mmsg(query, "SELECT JobId,ObjectLength,ObjectFullLength,ObjectIndex,"
-                      "ObjectType,ObjectCompression,FileIndex,ObjectName,"
-                      "RestoreObject "
-               "FROM RestoreObject "
-              "WHERE JobId IN (%s) "
-              "ORDER BY ObjectIndex ASC", jcr->JobIds);
    
    /* restore_object_handler is called for each file found */
+   
+   /* send restore objects for all jobs involved  */
+   Mmsg(query, get_restore_objects, jcr->JobIds, FT_RESTORE_FIRST);
+   db_sql_query(jcr->db, query.c_str(), restore_object_handler, (void *)&octx);
+
+   /* send config objects for the current restore job */
+   Mmsg(query, get_restore_objects, 
+        edit_uint64(jcr->JobId, ed1), FT_PLUGIN_CONFIG_FILLED);
    db_sql_query(jcr->db, query.c_str(), restore_object_handler, (void *)&octx);
 
    /*