From: Eric Bollengier Date: Wed, 4 Jan 2012 13:12:21 +0000 (+0100) Subject: Use RestoreObject type in Catalog X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=37e429247dc856cf756963e8eb1e9b35da0af26b;p=bacula%2Fbacula Use RestoreObject type in Catalog --- diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 5c8ec87dde..2f0eb5f222 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -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) { diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 85e6055343..0add6c181e 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -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); /*