[tracker] file-notifier: Exclude pending dirs from the contents sparql query
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] file-notifier: Exclude pending dirs from the contents sparql query
- Date: Tue, 17 Mar 2015 20:41:06 +0000 (UTC)
commit c5425cd5afb583fafe86ca61a2f4fb6047873891
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Mar 17 18:46:51 2015 +0100
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
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 b82b43a..6f094ba 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]