[tracker/tracker-0.12] libtracker-data: Do not reset database on unsupported ontology change



commit 202640dd9b5a2b76e620b10d1e085e2cc55fcb07
Author: JÃrg Billeter <j bitron ch>
Date:   Mon Sep 12 17:08:36 2011 +0200

    libtracker-data: Do not reset database on unsupported ontology change
    
    If the journal is disabled, do not reset database on unsupported
    ontology change as this would loose data. Instead, continue operation
    with old ontology version.

 src/libtracker-data/tracker-data-manager.c |   10 ++++++----
 src/libtracker-data/tracker-db-manager.h   |    9 +++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 651458a..db08a10 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -120,8 +120,10 @@ handle_unsupported_ontology_change (const gchar  *ontology_path,
                                     const gchar  *attempted_new,
                                     GError      **error)
 {
+#ifndef DISABLE_JOURNAL
 	/* force reindex on restart */
 	tracker_db_manager_remove_version_file ();
+#endif /* DISABLE_JOURNAL */
 
 	g_set_error (error, TRACKER_DATA_ONTOLOGY_ERROR,
 	             TRACKER_DATA_UNSUPPORTED_ONTOLOGY_CHANGE,
@@ -3838,7 +3840,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 
 			/* Load ontology from database into memory */
 			db_get_static_data (iface, &internal_error);
-			check_ontology = TRUE;
+			check_ontology = (flags & TRACKER_DB_MANAGER_DO_NOT_CHECK_ONTOLOGY) == 0;
 
 			if (internal_error) {
 				g_propagate_error (error, internal_error);
@@ -4049,7 +4051,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 						/* This also does tracker_locale_shutdown */
 						tracker_data_manager_shutdown ();
 
-						return tracker_data_manager_init (flags,
+						return tracker_data_manager_init (flags | TRACKER_DB_MANAGER_DO_NOT_CHECK_ONTOLOGY,
 						                                  test_schemas,
 						                                  first_time,
 						                                  journal_check,
@@ -4139,7 +4141,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 					/* This also does tracker_locale_shutdown */
 					tracker_data_manager_shutdown ();
 
-					return tracker_data_manager_init (flags,
+					return tracker_data_manager_init (flags | TRACKER_DB_MANAGER_DO_NOT_CHECK_ONTOLOGY,
 					                                  test_schemas,
 					                                  first_time,
 					                                  journal_check,
@@ -4235,7 +4237,7 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 				/* This also does tracker_locale_shutdown */
 				tracker_data_manager_shutdown ();
 
-				return tracker_data_manager_init (flags,
+				return tracker_data_manager_init (flags | TRACKER_DB_MANAGER_DO_NOT_CHECK_ONTOLOGY,
 				                                  test_schemas,
 				                                  first_time,
 				                                  journal_check,
diff --git a/src/libtracker-data/tracker-db-manager.h b/src/libtracker-data/tracker-db-manager.h
index e012bbb..9b6e2c4 100644
--- a/src/libtracker-data/tracker-db-manager.h
+++ b/src/libtracker-data/tracker-db-manager.h
@@ -42,11 +42,12 @@ typedef enum {
 } TrackerDB;
 
 typedef enum {
-	TRACKER_DB_MANAGER_FORCE_REINDEX    = 1 << 1,
-	TRACKER_DB_MANAGER_REMOVE_CACHE     = 1 << 2,
+	TRACKER_DB_MANAGER_FORCE_REINDEX         = 1 << 1,
+	TRACKER_DB_MANAGER_REMOVE_CACHE          = 1 << 2,
 	/* 1 << 3 Was low mem mode */
-	TRACKER_DB_MANAGER_REMOVE_ALL       = 1 << 4,
-	TRACKER_DB_MANAGER_READONLY         = 1 << 5
+	TRACKER_DB_MANAGER_REMOVE_ALL            = 1 << 4,
+	TRACKER_DB_MANAGER_READONLY              = 1 << 5,
+	TRACKER_DB_MANAGER_DO_NOT_CHECK_ONTOLOGY = 1 << 6
 } TrackerDBManagerFlags;
 
 GType               tracker_db_get_type                       (void) G_GNUC_CONST;



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