1 Index: src/dird/backup.c
2 ===================================================================
3 --- src/dird/backup.c (revision 7339)
4 +++ src/dird/backup.c (working copy)
8 POOLMEM *jobids = get_pool_memory(PM_FNAME);
10 db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, jobids);
14 Dmsg2(200, "jobids=%s nb=%s\n", jobids, nb);
15 jcr->file_bsock->fsend("accurate files=%s\n", nb);
17 - db_get_file_list(jcr, jcr->db, jobids, accurate_list_handler, (void *)jcr);
18 + if (!db_open_batch_connexion(jcr, jcr->db)) {
19 + Mmsg1(&jcr->db->errmsg, "Can't start accurate mode");
20 + Jmsg1(jcr, M_FATAL, 0, "%s", jcr->db->errmsg);
24 + db_get_file_list(jcr, jcr->db_batch, jobids, accurate_list_handler, (void *)jcr);
26 free_pool_memory(jobids);
29 Index: src/cats/sql_create.c
30 ===================================================================
31 --- src/cats/sql_create.c (revision 7339)
32 +++ src/cats/sql_create.c (working copy)
35 int JobStatus = jcr->JobStatus;
37 - if (!jcr->db_batch) { /* no files to backup ? */
38 + if (!jcr->batch_started) { /* no files to backup ? */
39 Dmsg0(50,"db_create_file_record : no files\n");
47 - * Create File record in B_DB
49 - * In order to reduce database size, we store the File attributes,
50 - * the FileName, and the Path separately. In principle, there
51 - * is a single FileName record and a single Path record, no matter
52 - * how many times it occurs. This is this subroutine, we separate
53 - * the file and the path and fill temporary tables with this three records.
55 -bool db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
56 +bool db_open_batch_connexion(JCR *jcr, B_DB *mdb)
58 - Dmsg1(dbglevel, "Fname=%s\n", ar->fname);
59 - Dmsg0(dbglevel, "put_file_into_catalog\n");
62 Dmsg2(100, "Opendb attr. Stream=%d fname=%s\n", ar->Stream, ar->fname);
63 jcr->db_batch = db_init_database(jcr,
65 Jmsg1(jcr, M_FATAL, 0, "%s", mdb->errmsg);
69 + Dmsg3(100, "initdb ref=%d connected=%d db=%p\n", jcr->db_batch->ref_count,
70 + jcr->db_batch->connected, jcr->db_batch->db);
77 + * Create File record in B_DB
79 + * In order to reduce database size, we store the File attributes,
80 + * the FileName, and the Path separately. In principle, there
81 + * is a single FileName record and a single Path record, no matter
82 + * how many times it occurs. This is this subroutine, we separate
83 + * the file and the path and fill temporary tables with this three records.
85 +bool db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
87 + Dmsg1(dbglevel, "Fname=%s\n", ar->fname);
88 + Dmsg0(dbglevel, "put_file_into_catalog\n");
90 + if (!jcr->batch_started) {
92 + if (!db_open_batch_connexion(jcr, mdb)) {
94 + "Can't start batch mode: ERR=%s", db_strerror(jcr->db_batch));
95 + Jmsg1(jcr, M_FATAL, 0, "%s", mdb->errmsg);
98 if (!sql_batch_start(jcr, jcr->db_batch)) {
100 "Can't start batch mode: ERR=%s", db_strerror(jcr->db_batch));
101 Jmsg1(jcr, M_FATAL, 0, "%s", mdb->errmsg);
104 - Dmsg3(100, "initdb ref=%d connected=%d db=%p\n", jcr->db_batch->ref_count,
105 - jcr->db_batch->connected, jcr->db_batch->db);
106 + jcr->batch_started = true;
108 B_DB *bdb = jcr->db_batch;