[tracker/rss-enclosures] libtracker-data: Force reindex on unsupported ontology change



commit b9eec1453afe758e71f5cf482f89c1ff292e23b1
Author: Jürg Billeter <j bitron ch>
Date:   Tue Oct 12 13:44:43 2010 +0200

    libtracker-data: Force reindex on unsupported ontology change
    
    Fixes NB#197546.

 src/libtracker-data/tracker-data-manager.c |    4 ++++
 src/libtracker-data/tracker-db-manager.c   |    7 +++----
 src/libtracker-data/tracker-db-manager.h   |    1 +
 3 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 89191d5..a3115d5 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -292,6 +292,8 @@ update_property_value (const gchar     *kind,
 			} else {
 
 				if (allowed && !is_allowed_conversion (str, object, allowed)) {
+					/* force reindex on restart */
+					tracker_db_manager_remove_version_file ();
 					g_error ("Ontology change conversion not allowed '%s' -> '%s' in '%s' of '%s'",
 					         str, object, predicate, subject);
 				}
@@ -357,6 +359,8 @@ check_range_conversion_is_allowed (const gchar *subject,
 
 		if (g_strcmp0 (object, str) != 0) {
 			if (!is_allowed_conversion (str, object, allowed_range_conversions)) {
+				/* force reindex on restart */
+				tracker_db_manager_remove_version_file ();
 				g_error ("Ontology change conversion not allowed '%s' -> '%s' in '%s' of '%s'",
 				         str, object, predicate, subject);
 			}
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 9ab399f..ae76ede 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -142,7 +142,6 @@ static gboolean            db_exec_no_reply    (TrackerDBInterface *iface,
 static TrackerDBInterface *db_interface_create (TrackerDB           db);
 static TrackerDBInterface *tracker_db_manager_get_db_interfaces     (gint num, ...);
 static TrackerDBInterface *tracker_db_manager_get_db_interfaces_ro  (gint num, ...);
-static void                db_remove_version_file (void);
 static void                db_remove_locale_file  (void);
 
 static gboolean              initialized;
@@ -411,15 +410,15 @@ db_manager_remove_all (gboolean rm_journal)
 
 		/* If also the journal is gone, we can also remove db-version.txt, it
 		 * would have no more relevance whatsoever. */
-		db_remove_version_file ();
+		tracker_db_manager_remove_version_file ();
 	}
 
 	/* Remove locale file also */
 	db_remove_locale_file ();
 }
 
-static void
-db_remove_version_file (void)
+void
+tracker_db_manager_remove_version_file (void)
 {
 	gchar *filename;
 
diff --git a/src/libtracker-data/tracker-db-manager.h b/src/libtracker-data/tracker-db-manager.h
index db369d3..407564f 100644
--- a/src/libtracker-data/tracker-db-manager.h
+++ b/src/libtracker-data/tracker-db-manager.h
@@ -65,6 +65,7 @@ void                tracker_db_manager_move_to_temp           (void);
 void                tracker_db_manager_restore_from_temp      (void);
 void                tracker_db_manager_init_locations         (void);
 gboolean            tracker_db_manager_has_enough_space       (void);
+void                tracker_db_manager_remove_version_file    (void);
 
 TrackerDBManagerFlags
                     tracker_db_manager_get_flags              (guint *select_cache_size,



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