[tracker/tracker-0.10] libtracker-data: Do not trigger replay with invalid ontology journal



commit 97a75dc288023e30f90f9d4a8e46c55a7beaf76c
Author: Jürg Billeter <j bitron ch>
Date:   Tue May 17 16:37:04 2011 +0200

    libtracker-data: Do not trigger replay with invalid ontology journal
    
    Use same criteria as with data journal.

 src/libtracker-data/tracker-data-manager.c |   29 +++++++++++++++++++--------
 1 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index fb309d6..ff9da8a 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -3565,18 +3565,29 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 	if (read_journal) {
 		in_journal_replay = TRUE;
 
-		tracker_db_journal_reader_ontology_init (NULL, &internal_error);
+		if (tracker_db_journal_reader_ontology_init (NULL, &internal_error)) {
+			/* Load ontology IDs from journal into memory */
+			load_ontology_ids_from_journal (&uri_id_map, &max_id);
 
-		if (internal_error) {
-			g_propagate_error (error, internal_error);
+			tracker_db_journal_reader_shutdown ();
+		} else {
+			if (internal_error) {
+				if (!g_error_matches (internal_error,
+					              TRACKER_DB_JOURNAL_ERROR,
+					              TRACKER_DB_JOURNAL_ERROR_BEGIN_OF_JOURNAL)) {
+					g_propagate_error (error, internal_error);
+					return FALSE;
+				} else {
+					g_clear_error (&internal_error);
+				}
+			}
 
-			return FALSE;
+			/* do not trigger journal replay if ontology journal
+			   does not exist or is not valid,
+			   same as with regular journal further above */
+			in_journal_replay = FALSE;
+			read_journal = FALSE;
 		}
-
-		/* Load ontology IDs from journal into memory */
-		load_ontology_ids_from_journal (&uri_id_map, &max_id);
-
-		tracker_db_journal_reader_shutdown ();
 	}
 
 	if (is_first_time_index && !read_only) {



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