[tracker/tracker-0.6] Avoid double reindexes from both trackerd and tracker-indexer
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-0.6] Avoid double reindexes from both trackerd and tracker-indexer
- Date: Mon, 8 Jun 2009 10:47:04 -0400 (EDT)
commit 3cec2e79f0b4d2f72a5326e6b1e541f75e0412c0
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jun 8 16:43:11 2009 +0200
Avoid double reindexes from both trackerd and tracker-indexer
Do not check ontology directory mtime, since system date could be broken.
instead, any external apps modifying ontology will have to issue a
tracker-processes -r.
Also, added a FORCE_NO_REINDEX flag to the DB manager, so we ensure the indexer
doesn't force deletion and creation of databases, which would make trackerd
look in the wrong way.
---
src/libtracker-db/tracker-db-manager.c | 17 ++++++-----------
src/libtracker-db/tracker-db-manager.h | 3 ++-
src/tracker-indexer/tracker-indexer.c | 2 +-
src/tracker-indexer/tracker-main.c | 2 +-
4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index d13d9f9..43e9e15 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -2256,16 +2256,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
g_message ("Could not find database file:'%s'", dbs[i].abs_filename);
g_message ("One or more database files are missing, a reindex will be forced");
need_reindex = TRUE;
- } else if (i == TRACKER_DB_COMMON) {
- guint64 mtime, services_dir_mtime;
-
- mtime = tracker_file_get_mtime (dbs[i].abs_filename);
- services_dir_mtime = tracker_file_get_mtime (services_dir);
-
- if (mtime < services_dir_mtime) {
- g_message ("Ontology is more recent than DB cache, a reindex will be forced");
- need_reindex = TRUE;
- }
}
}
@@ -2293,7 +2283,8 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
* NOT the paths, note, that these paths are also used for
* other things like the nfs lock file.
*/
- if (flags & TRACKER_DB_MANAGER_FORCE_REINDEX || need_reindex) {
+ if ((flags & TRACKER_DB_MANAGER_FORCE_NO_REINDEX) == 0 &&
+ ((flags & TRACKER_DB_MANAGER_FORCE_REINDEX) != 0 || need_reindex)) {
if (first_time) {
*first_time = TRUE;
}
@@ -2336,6 +2327,10 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
} else {
+ if ((flags & TRACKER_DB_MANAGER_FORCE_NO_REINDEX) && need_reindex) {
+ g_message ("Reindex was needed, but has been forbidden by NO_REINDEX flag");
+ }
+
/* Make sure we remove and recreate the cache directory in tmp
* each time we start up, this is meant to be a per-run
* thing.
diff --git a/src/libtracker-db/tracker-db-manager.h b/src/libtracker-db/tracker-db-manager.h
index c54d01f..9aca30e 100644
--- a/src/libtracker-db/tracker-db-manager.h
+++ b/src/libtracker-db/tracker-db-manager.h
@@ -55,7 +55,8 @@ typedef enum {
TRACKER_DB_MANAGER_FORCE_REINDEX = 1 << 1,
TRACKER_DB_MANAGER_REMOVE_CACHE = 1 << 2,
TRACKER_DB_MANAGER_LOW_MEMORY_MODE = 1 << 3,
- TRACKER_DB_MANAGER_REMOVE_ALL = 1 << 4
+ TRACKER_DB_MANAGER_REMOVE_ALL = 1 << 4,
+ TRACKER_DB_MANAGER_FORCE_NO_REINDEX = 1 << 5
} TrackerDBManagerFlags;
#define TRACKER_DB_FOR_FILE_SERVICE "Files"
diff --git a/src/tracker-indexer/tracker-indexer.c b/src/tracker-indexer/tracker-indexer.c
index 59492b4..378dda7 100644
--- a/src/tracker-indexer/tracker-indexer.c
+++ b/src/tracker-indexer/tracker-indexer.c
@@ -3668,7 +3668,7 @@ static gboolean
set_profile (TrackerIndexer *indexer,
const gchar *profile_name)
{
- TrackerDBManagerFlags flags = 0;
+ TrackerDBManagerFlags flags = TRACKER_DB_MANAGER_FORCE_NO_REINDEX;
TrackerIndexerPrivate *priv;
gboolean return_val = TRUE;
diff --git a/src/tracker-indexer/tracker-main.c b/src/tracker-indexer/tracker-main.c
index aad1b15..f63e8d9 100644
--- a/src/tracker-indexer/tracker-main.c
+++ b/src/tracker-indexer/tracker-main.c
@@ -285,7 +285,7 @@ main (gint argc, gchar *argv[])
TrackerConfig *config;
TrackerLanguage *language;
TrackerIndexer *indexer;
- TrackerDBManagerFlags flags = 0;
+ TrackerDBManagerFlags flags = TRACKER_DB_MANAGER_FORCE_NO_REINDEX;
GOptionContext *context;
GError *error = NULL;
gchar *filename;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]