diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-03-17 18:46:51 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2015-03-17 20:05:59 +0100 |
commit | c5425cd5afb583fafe86ca61a2f4fb6047873891 (patch) | |
tree | 4a898529fa171419d43bef436579a32b32c0090a | |
parent | 9981689c3ee8a1baa7f1967b209e7ba6bd77682e (diff) | |
download | tracker-c5425cd5afb583fafe86ca61a2f4fb6047873891.tar.gz |
file-notifier: Exclude pending dirs from the contents sparql query
Directories added to the pending queue (ie. at the edge of max-depth)
may also be signaled as "updated" and added to the updated files array.
As these directories will be crawled/queried independently later on,
it doesn't make sense to include these in the current query for
directory contents.
This fixes spurious reindexes seen across tracker-miner-fs restarts,
an(y) updated folder would be added on both queue/array, the sparql
query for directory contents would include that folder that hasn't
been crawled yet (hence being in the pending queue) and incorrectly
signal all its contents as deleted. The folder would be just reindexed
again from scratch on the next restart.
https://bugzilla.gnome.org/show_bug.cgi?id=741852
-rw-r--r-- | src/libtracker-miner/tracker-file-notifier.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c index b82b43a86..6f094bacb 100644 --- a/src/libtracker-miner/tracker-file-notifier.c +++ b/src/libtracker-miner/tracker-file-notifier.c @@ -685,7 +685,8 @@ sparql_contents_query_cb (GObject *object, static gchar * sparql_contents_compose_query (GFile **directories, - guint n_dirs) + guint n_dirs, + GQueue *filter) { GString *str; gchar *uri; @@ -695,6 +696,9 @@ sparql_contents_compose_query (GFile **directories, " ?u nfo:belongsToContainer ?f . ?f nie:url ?url ." " FILTER (?url IN ("); for (i = 0; i < n_dirs; i++) { + if (g_queue_find (filter, directories[i])) + continue; + if (i != 0) g_string_append_c (str, ','); @@ -711,13 +715,14 @@ sparql_contents_compose_query (GFile **directories, static void sparql_contents_query_start (TrackerFileNotifier *notifier, GFile **directories, - guint n_dirs) + guint n_dirs, + GQueue *filter) { TrackerFileNotifierPrivate *priv; gchar *sparql; priv = notifier->priv; - sparql = sparql_contents_compose_query (directories, n_dirs); + sparql = sparql_contents_compose_query (directories, n_dirs, filter); tracker_sparql_connection_query_async (priv->connection, sparql, priv->cancellable, @@ -757,7 +762,8 @@ sparql_files_query_cb (GObject *object, /* Updated directories have been found, check for deleted contents in those */ sparql_contents_query_start (notifier, (GFile**) priv->current_index_root->updated_dirs->pdata, - priv->current_index_root->updated_dirs->len); + priv->current_index_root->updated_dirs->len, + priv->current_index_root->pending_dirs); g_ptr_array_set_size (priv->current_index_root->updated_dirs, 0); } else { finish_current_directory (notifier); |