[tracker/tracker-0.10-miner-fs-crawl-on-remount] libtracker-miner: ensure mtime checks on directories found during crawling
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10-miner-fs-crawl-on-remount] libtracker-miner: ensure mtime checks on directories found during crawling
- Date: Wed, 20 Jul 2011 14:50:15 +0000 (UTC)
commit adae351127feabea39ab2a04e198738248702c5f
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Jul 20 16:04:21 2011 +0200
libtracker-miner: ensure mtime checks on directories found during crawling
Fixes NB#273120
src/libtracker-miner/tracker-miner-fs.c | 32 +++++++++++++++---------------
1 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 69c2d6a..6bcd50d 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -184,7 +184,7 @@ struct _TrackerMinerFSPrivate {
GQuark quark_ignore_file;
GQuark quark_attribute_updated;
- GQuark quark_check_existence;
+ GQuark quark_directory_found_crawling;
GList *config_directories;
@@ -729,7 +729,7 @@ tracker_miner_fs_init (TrackerMinerFS *object)
object);
priv->quark_ignore_file = g_quark_from_static_string ("tracker-ignore-file");
- priv->quark_check_existence = g_quark_from_static_string ("tracker-check-existence");
+ priv->quark_directory_found_crawling = g_quark_from_static_string ("tracker-directory-found-crawling");
priv->quark_attribute_updated = g_quark_from_static_string ("tracker-attribute-updated");
priv->iri_cache = g_hash_table_new_full (g_file_hash,
@@ -2823,14 +2823,10 @@ item_queue_handlers_cb (gpointer user_data)
keep_processing = item_remove (fs, file);
break;
case QUEUE_CREATED:
- /* Check existence before processing, if requested to do so. */
+ /* If the item is a directory which was found during crawling, we need
+ * to check existence before processing */
if (g_object_get_qdata (G_OBJECT (file),
- fs->priv->quark_check_existence)) {
- /* Clear the qdata */
- g_object_set_qdata (G_OBJECT (file),
- fs->priv->quark_check_existence,
- GINT_TO_POINTER (FALSE));
-
+ fs->priv->quark_directory_found_crawling)) {
/* Avoid adding items that already exist, when processing
* a CREATED task (as those generated when crawling) */
if (!item_query_exists (fs, file, FALSE, NULL, NULL)) {
@@ -2993,6 +2989,7 @@ ensure_mtime_cache (TrackerMinerFS *fs,
gchar *query, *uri;
GFile *parent;
guint cache_size;
+ GList *parent_in_queue;
if (G_UNLIKELY (!fs->priv->mtime_cache)) {
fs->priv->mtime_cache = g_hash_table_new_full (g_file_hash,
@@ -3030,11 +3027,15 @@ ensure_mtime_cache (TrackerMinerFS *fs,
/* Hack hack alert!
* Before querying the store, check if the parent directory is scheduled to
- * be added, and if so, leave the mtime cache empty.
+ * be added, and if so, leave the mtime cache empty. We only do this if we
+ * are not currently crawling the given directory.
*/
- if (g_queue_find_custom (fs->priv->items_created,
- parent,
- (GCompareFunc)tracker_file_cmp) != NULL) {
+ parent_in_queue = g_queue_find_custom (fs->priv->items_created,
+ parent,
+ (GCompareFunc)tracker_file_cmp);
+ if (parent_in_queue &&
+ !g_object_get_qdata (G_OBJECT (parent_in_queue->data),
+ fs->priv->quark_directory_found_crawling)) {
uri = g_file_get_uri (file);
g_debug ("Empty mtime cache for URI '%s' "
"(parent scheduled to be created)",
@@ -3790,10 +3791,9 @@ crawler_check_directory_contents_cb (TrackerCrawler *crawler,
* -mtime_checking is TRUE.
*/
if (fs->priv->been_crawled || fs->priv->mtime_checking) {
- /* Set quark so that before trying to add the item we first
- * check for its existence. */
+ /* Set quark to identify item found during crawling */
g_object_set_qdata (G_OBJECT (parent),
- fs->priv->quark_check_existence,
+ fs->priv->quark_directory_found_crawling,
GINT_TO_POINTER (TRUE));
/* Before adding the monitor, start notifying the store
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]