ret = db_create_file_attributes_record(jcr, mdb, ar);
} else if (jcr->HasBase) {
- ret = db_create_base_file_attributes_record(jcr, jcr->db_batch, ar);
+ ret = db_create_base_file_attributes_record(jcr, mdb, ar);
} else {
Jmsg0(jcr, M_FATAL, 0, _("Can't Copy/Migrate job using BaseJob"));
"AND A.Name = B.Name "
"ORDER BY B.FileId)",
edit_uint64(jcr->JobId, ed1), ed1, ed1);
- ret = INSERT_DB(jcr, mdb, mdb->cmd);
- Dmsg1(0, "commit_base_file_list = %lld\n", (uint64_t) mdb->num_rows);
+ ret = QUERY_DB(jcr, mdb, mdb->cmd);
+ jcr->nb_base_files_used = sql_affected_rows(mdb);
db_cleanup_base_file(jcr, mdb);
db_unlock(mdb);
"JOIN File ON (File.FileId = Temp.FileId) "
"WHERE File.FileIndex > 0)",
(uint64_t)jcr->JobId, jobids);
- ret = INSERT_DB(jcr, mdb, mdb->cmd);
- Dmsg1(0, "create_base_file_list = %lld\n", (uint64_t) mdb->num_rows);
+ ret = QUERY_DB(jcr, mdb, mdb->cmd);
bail_out:
db_unlock(mdb);
return ret;
}
if (jcr->HasBase) {
- db_create_base_file_list(jcr, jcr->db_batch, jobids);
- db_get_base_file_list(jcr, jcr->db_batch,
+ jcr->nb_base_files = str_to_int64(nb);
+ db_create_base_file_list(jcr, jcr->db, jobids);
+ db_get_base_file_list(jcr, jcr->db,
accurate_list_handler, (void *)jcr);
} else {
db_write_batch_file_records(jcr); /* used by bulk batch file insert */
if (jcr->HasBase &&
- !db_commit_base_file_attributes_record(jcr, jcr->db_batch))
+ !db_commit_base_file_attributes_record(jcr, jcr->db))
{
- Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db_batch));
+ Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
}
if (stat == JS_Terminated) {
jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg));
jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
+ if (jcr->HasBase) {
+ Dmsg3(0, "Base files/Used files %lld/%lld=%.2f%%\n", jcr->nb_base_files,
+ jcr->nb_base_files_used,
+ jcr->nb_base_files_used*100.0/jcr->nb_base_files);
+ }
// bmicrosleep(15, 0); /* for debugging SIGHUP */
Jmsg(jcr, msg_type, 0, _("%s %s %s (%s): %s\n"
}
accurate_free(jcr);
- }
+ if (jcr->get_JobLevel() == L_FULL) {
+ Dmsg1(0, "Space saved with Base jobs: %lld MB\n",
+ jcr->base_size/(1024*1024));
+ }
+ }
return ret;
}
}
#endif
+ /* compute space saved with basefile */
+ if (jcr->get_JobLevel() == L_FULL && !stat) {
+ jcr->base_size += ff_pkt->statp.st_size;
+ }
+
accurate_mark_file_as_seen(jcr, &elt);
// Dmsg2(dbglvl, "accurate %s = %d\n", fname, stat);
bool VSS; /* VSS used by FD */
bool multi_restore; /* Dir can do multiple storage restore */
htable *file_list; /* Previous file list (accurate mode) */
+ uint64_t base_size; /* compute space saved with base job */
#endif /* FILE_DAEMON */