[tracker] libtracker-miner: Add envvar toggle to force directory updated checks



commit 6e42c641b8ed48a39a4e3dec9b4a138b8173ea94
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 15 23:39:35 2016 +0100

    libtracker-miner: Add envvar toggle to force directory updated checks
    
    The bugs covered by the last patches might leave leftovers in the DB if
    tracker-miner-fs updated a directory after it changed between runs, but
    wouldn't delete contents that were removed from the filesystem.
    
    Add this toggle envvar to point people to a solution, if you've seen errors
    like "UNIQUE constraint failed: nie:DataObject.nie:url" in journald, you're
    affected by these bugs, and should run tracker-miner-fs once with
    TRACKER_MINER_FORCE_CHECK_UPDATED set in the environment. Running just
    once will be enough, enabling this always will incur in startup performance
    penalties.

 src/libtracker-miner/tracker-file-notifier.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 1b47620..4c654dd 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -32,6 +32,7 @@
 static GQuark quark_property_iri = 0;
 static GQuark quark_property_store_mtime = 0;
 static GQuark quark_property_filesystem_mtime = 0;
+static gboolean force_check_updated = FALSE;
 
 #define MAX_DEPTH 1
 
@@ -375,6 +376,9 @@ file_notifier_is_directory_modified (TrackerFileNotifier *notifier,
        TrackerFileNotifierPrivate *priv;
        guint64 *store_mtime, *disk_mtime;
 
+       if (G_UNLIKELY (force_check_updated))
+               return TRUE;
+
        priv = notifier->priv;
        store_mtime = tracker_file_system_get_property (priv->file_system, file,
                                                        quark_property_store_mtime);
@@ -1631,6 +1635,8 @@ tracker_file_notifier_class_init (TrackerFileNotifierClass *klass)
        quark_property_filesystem_mtime = g_quark_from_static_string ("tracker-property-filesystem-mtime");
        tracker_file_system_register_property (quark_property_filesystem_mtime,
                                               g_free);
+
+       force_check_updated = g_getenv ("TRACKER_MINER_FORCE_CHECK_UPDATED") != NULL;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]