static void eliminate_verify_records();
static void eliminate_orphaned_object_records();
static void eliminate_orphaned_meta_records();
+static void eliminate_orphaned_fileevents_records();
static void repair_bad_paths();
static void do_interactive_mode();
static bool yes_no(const char *prompt);
eliminate_restore_records();
eliminate_orphaned_meta_records();
eliminate_orphaned_object_records();
+ eliminate_orphaned_fileevents_records();
} else {
do_interactive_mode();
}
" 7) Eliminate orphaned Path records\n"
" 8) Eliminate orphaned FileSet records\n"
" 9) Eliminate orphaned Client records\n"
-" 10) Eliminate orphaned Meta data records\n"
+" 10) Eliminate orphaned Meta/FileEvents data records\n"
" 11) Eliminate orphaned Job records\n"
" 12) Eliminate all Admin records\n"
" 13) Eliminate all Restore records\n"
" 7) Check for orphaned Path records\n"
" 8) Check for orphaned FileSet records\n"
" 9) Check for orphaned Client records\n"
-" 10) Check all orphaned Meta data records\n"
+" 10) Check all orphaned Meta/FileEvents data records\n"
" 11) Check for orphaned Job records\n"
" 12) Check for all Admin records\n"
" 13) Check for all Restore records\n"
break;
case 10:
eliminate_orphaned_meta_records();
+ eliminate_orphaned_fileevents_records();
break;
case 11:
eliminate_orphaned_job_records();
eliminate_orphaned_fileset_records();
eliminate_orphaned_client_records();
eliminate_orphaned_meta_records();
+ eliminate_orphaned_fileevents_records();
eliminate_orphaned_job_records();
eliminate_admin_records();
eliminate_restore_records();
}
}
+static void eliminate_orphaned_fileevents_records()
+{
+ const char *q;
+ db_int64_ctx lctx1;
+ printf_tstamp(_("Checking for orphaned FileEvents entries.\n"));
+
+ q = "SELECT COUNT(1) FROM FileEvents WHERE JobId NOT IN (SELECT DISTINCT JobId from Job)";
+ if (!db_sql_query(db, q, db_int64_handler, &lctx1)) {
+ printf_tstamp("%s\n", db_strerror(db));
+ }
+
+ printf_tstamp(_("Found %lld orphaned FileEvents records.\n"), lctx1.value);
+
+ if (fix && lctx1.count > 0) {
+ printf_tstamp(_("Deleting %lld orphaned FileEvents records.\n"), lctx1.value);
+ q = "DELETE FROM FileEvents WHERE JobId NOT IN (SELECT DISTINCT JobId from Job)";
+ if (!db_sql_query(db, q, NULL, NULL)) {
+ printf_tstamp("%s\n", db_strerror(db));
+ }
+ }
+}
+
static void eliminate_orphaned_path_records()
{
db_int64_ctx lctx;