Index: src/dird/backup.c
===================================================================
---- src/dird/backup.c (revision 6372)
-+++ src/dird/backup.c (working copy)
+--- src/dird/backup.c (révision 6373)
++++ src/dird/backup.c (copie de travail)
@@ -44,6 +44,7 @@
#include "bacula.h"
#include "dird.h"
/* Commands sent to File daemon */
static char backupcmd[] = "backup\n";
-@@ -97,6 +98,300 @@
+@@ -97,6 +98,308 @@
}
/*
+ * Need to insert file and attributes to temp table
+ * Batch compare files and attributes
+ *
++ * If file have file_index=0, they are discarded by FD
+ *
+ */
+bool accurate_compute_files(JCR *jcr)
+ fdbr.JobId = JobId;
+ jcr->FileIndex = 0;
+
-+ if (jcr->accurate == false || jcr->JobLevel == L_FULL) {
++ if (/*jcr->accurate == false ||*/ jcr->JobLevel == L_FULL) {
+ return true;
+ }
+
+ return false;
+ }
+
-+ Dmsg0(20, "bdird: waiting to receive file attributes\n");
++ Dmsg0(1, "bdird: waiting to receive file attributes\n");
+ /*
+ * Get Attributes and Signature from File daemon
+ * We expect:
+ }
+ fname = check_pool_memory_size(fname, fd->msglen);
+ jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
-+ Dmsg1(20, "Atts+Digest=%s\n", fd->msg);
++ Dmsg1(1, "Atts+Digest=%s\n", fd->msg);
+ if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream,
+ fname)) != 3) {
+ Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 3 fields got %d\n"
+ * Find equivalent record in the database
+ */
+ fdbr.FileId = 0;
++ /* If file_index==0, file is not saved by fd, check them */
+ if (!db_accurate_get_file_attributes_record(jcr, jcr->db, jcr->fname, backupid, &fdbr)) {
+ Jmsg(jcr, M_INFO, 0, _("New file: %s\n"), jcr->fname);
-+ Dmsg1(020, _("File not in catalog: %s\n"), jcr->fname);
++ Dmsg1(1, _("File not in catalog: %s\n"), jcr->fname);
+ continue;
+ } else {
++ Dmsg1(1, _("File in catalog: %s\n"), jcr->fname);
+ /*
+ * mark file record as visited by stuffing the
+ * current JobId, which is unique, into the MarkId field.
+ * Loop over options supplied by user and verify the
+ * fields he requests.
+ */
++ stat = JS_Terminated; /* TODO: track changes */
+ for (p=Opts_Digest; *p; p++) {
+ char ed1[30], ed2[30];
+ switch (*p) {
+ break;
+ }
+ }
++ if (stat == JS_Differences) {
++ Jmsg(jcr, M_INFO, 0, _(" fname=%s\n"), jcr->fname);
++ }
++
+ /*
+ * Got Digest Signature from Storage daemon
+ * It came across in the Opts_Digest field.
* Do a backup of the specified FileSet
*
* Returns: false on failure
-@@ -231,6 +526,13 @@
+@@ -231,6 +534,13 @@
goto bail_out;
}
db_write_batch_file_records(jcr); /* used by bulk batch file insert */
Index: src/dird/inc_conf.c
===================================================================
---- src/dird/inc_conf.c (revision 6372)
-+++ src/dird/inc_conf.c (working copy)
+--- src/dird/inc_conf.c (révision 6373)
++++ src/dird/inc_conf.c (copie de travail)
@@ -94,6 +94,7 @@
* Items that are valid in an Options resource
*/
Index: src/dird/dird_conf.c
===================================================================
---- src/dird/dird_conf.c (revision 6372)
-+++ src/dird/dird_conf.c (working copy)
+--- src/dird/dird_conf.c (révision 6373)
++++ src/dird/dird_conf.c (copie de travail)
@@ -319,6 +319,7 @@
{"selectionpattern", store_str, ITEM(res_job.selection_pattern), 0, 0, 0},
{"runscript", store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0},
}
Index: src/dird/dird_conf.h
===================================================================
---- src/dird/dird_conf.h (revision 6372)
-+++ src/dird/dird_conf.h (working copy)
+--- src/dird/dird_conf.h (révision 6373)
++++ src/dird/dird_conf.h (copie de travail)
@@ -400,6 +400,7 @@
bool write_part_after_job; /* Set to write part after job in SD */
bool enabled; /* Set if job enabled */
SCHED *schedule; /* When -- Automatic schedule */
Index: src/filed/backup.c
===================================================================
---- src/filed/backup.c (revision 6372)
-+++ src/filed/backup.c (working copy)
-@@ -50,6 +50,81 @@
+--- src/filed/backup.c (révision 6373)
++++ src/filed/backup.c (copie de travail)
+@@ -50,6 +50,98 @@
static bool crypto_session_send(JCR *jcr, BSOCK *sd);
/*
+ * Called by save_file when accept/discard file for backup
++ *
+ * TODO: we could add MD5/SHAX digest, but we have to compute it
+ * for all files.
+ */
+ return true;
+ }
+
-+ if (!stats) {
++ if (!stats) { /* TODO: don't always compute attribute */
+ file_index=0;
+ encode_stat(attribs, ff_pkt, 0);
+ a = attribs;
+ }
+
-+ if (ff_pkt->type == FT_LNK || ff_pkt->type == FT_LNKSAVED) {
++ switch (ff_pkt->type) {
++ case FT_LNKSAVED: /* Hard linked, file already saved */
++ case FT_LNK:
+ stat = dir->fsend("%d %d %s %s%c%s%c%s%c", file_index,
+ STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->fname,
+ 0, a, 0, ff_pkt->link, 0);
-+ } else if (ff_pkt->type == FT_DIREND || ff_pkt->type == FT_REPARSE) {
-+ /* Here link is the canonical filename (i.e. with trailing slash) */
-+ stat = dir->fsend("%d %d %s %s%c%s%c%c", file_index,
-+ STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->link,
-+ 0, a, 0, 0);
-+ } else {
++ break;
++ case FT_REGE:
++ case FT_REG:
++ case FT_SPEC:
++ case FT_RAW:
++ case FT_FIFO:
++ case FT_NOCHG:
+ stat = dir->fsend("%d %d %s %s%c%s%c%c", file_index,
+ STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->fname,
+ 0, a, 0, 0);
++
++ break;
++ case FT_REPARSE:
++ case FT_DIREND:
++ case FT_NORECURSE:
++ case FT_DIRNOCHG:
++ stat = dir->fsend("%d %d %s %s%c%s%c%c", file_index,
++ STREAM_UNIX_ATTRIBUTES, ff_pkt->VerifyOpts, ff_pkt->link,
++ 0, a, 0, 0);
++ break;
++ default:
++ Dmsg2(1, _("Fname=%s Type=%i\n"), ff_pkt->fname, ff_pkt->type);
++ return true;
+ }
+
+ if (!stat) {
* Find all the requested files and send them
* to the Storage daemon.
*
-@@ -66,6 +141,7 @@
+@@ -66,6 +158,9 @@
BSOCK *sd;
bool ok = true;
// TODO landonf: Allow user to specify encryption algorithm
-+ jcr->accurate=true; /* TODO: remove that */
++ if (jcr->JobLevel != L_FULL) {
++ jcr->accurate=true; /* TODO: remove that */
++ }
sd = jcr->store_bsock;
-@@ -135,6 +211,20 @@
+@@ -134,6 +229,20 @@
+ ok = false; /* error */
set_jcr_job_status(jcr, JS_ErrorTerminated);
}
-
++ Dmsg1(1, "jcr->accurate == %i\n", jcr->accurate);
+ /* start accurate stuffs */
+ if (jcr->accurate) {
+ /* TODO: test job_canceled() */
+// accurate_send_file_list(jcr); /* send all new files to DIR */
+ accurate_send_deleted_list(jcr); /* send deleted list to SD */
+ }
-+
+
free_pool_memory(jcr->acl_text);
- stop_heartbeat_monitor(jcr);
-@@ -355,9 +445,11 @@
+@@ -355,9 +464,11 @@
case FT_DIRNOCHG:
case FT_NOCHG:
Jmsg(jcr, M_SKIPPED, 1, _(" Unchanged file skipped: %s\n"), ff_pkt->fname);
return 1;
case FT_NOOPEN: {
berrno be;
-@@ -1111,6 +1203,9 @@
+@@ -1111,6 +1222,9 @@
}
unstrip_path(ff_pkt);
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"),
Index: src/filed/job.c
===================================================================
---- src/filed/job.c (revision 6372)
-+++ src/filed/job.c (working copy)
+--- src/filed/job.c (révision 6373)
++++ src/filed/job.c (copie de travail)
@@ -1087,6 +1087,9 @@
case 'c':
fo->flags |= FO_CHKCHANGES;
break;
Index: src/cats/make_postgresql_tables.in
===================================================================
---- src/cats/make_postgresql_tables.in (revision 6372)
-+++ src/cats/make_postgresql_tables.in (working copy)
+--- src/cats/make_postgresql_tables.in (révision 6373)
++++ src/cats/make_postgresql_tables.in (copie de travail)
@@ -43,6 +43,58 @@
CREATE INDEX file_jobid_idx on file (jobid);
CREATE INDEX file_fp_idx on file (filenameid, pathid);
-- if your Verifies are too slow.
Index: src/cats/protos.h
===================================================================
---- src/cats/protos.h (revision 6372)
-+++ src/cats/protos.h (working copy)
+--- src/cats/protos.h (révision 6373)
++++ src/cats/protos.h (copie de travail)
@@ -82,10 +82,12 @@
/* sql_find.c */
bool db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime);
bool db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr);
Index: src/cats/sql_find.c
===================================================================
---- src/cats/sql_find.c (revision 6372)
-+++ src/cats/sql_find.c (working copy)
+--- src/cats/sql_find.c (révision 6373)
++++ src/cats/sql_find.c (copie de travail)
@@ -190,7 +190,55 @@
return true;
}
* VERIFY_CATALOG we want the JobId of the last INIT.
Index: src/cats/sql_create.c
===================================================================
---- src/cats/sql_create.c (revision 6372)
-+++ src/cats/sql_create.c (working copy)
+--- src/cats/sql_create.c (révision 6373)
++++ src/cats/sql_create.c (copie de travail)
@@ -829,6 +829,14 @@
return true;
}
*
Index: src/cats/sql_get.c
===================================================================
---- src/cats/sql_get.c (revision 6372)
-+++ src/cats/sql_get.c (working copy)
+--- src/cats/sql_get.c (révision 6373)
++++ src/cats/sql_get.c (copie de travail)
@@ -66,6 +66,8 @@
*
* Returns: 0 on failure
*/
int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr, FILE_DBR *fdbr)
{
-@@ -86,7 +88,70 @@
+@@ -86,7 +88,73 @@
return stat;
}
+ */
+int db_accurate_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JobId_t backupid, FILE_DBR *fdbr)
+{
-+ int stat;
++ int stat=0;
+ char ed1[50];
+ SQL_ROW row;
+ mdb->esc_path,
+ mdb->esc_name,
+ edit_int64(backupid, ed1));
++
++ Dmsg1(1,"get_file %s\n", mdb->cmd);
+
+ if (QUERY_DB(jcr, mdb, mdb->cmd)) {
+ char ed1[30];
+ fdbr->FileIndex = str_to_int64(row[5]);
+ fdbr->MarkId = str_to_int64(row[6]);
+ fdbr->JobId = str_to_int64(row[7]);
++ stat=1;
+ }
+ } else {
-+ Mmsg1(mdb->errmsg, _("Get DB File record %s failed\n"),fname);
++ Mmsg2(mdb->errmsg, _("Get DB File record %s failed num=%i\n"),fname,mdb->num_rows);
+ Jmsg(jcr, M_WARNING, 0, "%s", mdb->errmsg);
+ }
+ sql_free_result(mdb);
* Returns: 0 on failure
Index: src/jcr.h
===================================================================
---- src/jcr.h (revision 6372)
-+++ src/jcr.h (working copy)
+--- src/jcr.h (révision 6373)
++++ src/jcr.h (copie de travail)
@@ -208,6 +208,7 @@
B_DB *db_batch; /* database pointer for batch insert */
ATTR_DBR *ar; /* DB attribute record */
void *plugin_ctx; /* current plugin context */
Index: src/findlib/find.h
===================================================================
---- src/findlib/find.h (revision 6372)
-+++ src/findlib/find.h (working copy)
+--- src/findlib/find.h (révision 6373)
++++ src/findlib/find.h (copie de travail)
@@ -108,6 +108,7 @@
#define FO_ENHANCEDWILD (1<<23) /* Enhanced wild card processing */
#define FO_CHKCHANGES (1<<24) /* Check if file have been modified during backup */