[tracker/urho-sync] Don't perform the check when need_journal isn't passed
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/urho-sync] Don't perform the check when need_journal isn't passed
- Date: Wed, 5 Aug 2009 09:17:29 +0000 (UTC)
commit 82003a5114bb6fd3ee69190be56e251afb7adace
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Aug 5 11:16:47 2009 +0200
Don't perform the check when need_journal isn't passed
src/libtracker-db/tracker-db-manager.c | 74 ++++++++++++++++++--------------
1 files changed, 42 insertions(+), 32 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index 89fee9c..b4fc682 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -1017,6 +1017,46 @@ tracker_db_manager_ensure_locale (void)
g_free (stored_locale);
}
+static gboolean
+check_meta_backup (void)
+{
+ const gchar *meta_filename;
+ gboolean retval = FALSE;
+
+ /* This is currently the only test for need_journal. We should add a
+ * couple tests that test meta.db against consistenty, and if not
+ * good, copy meta-backup.db over and set need_journal (being less
+ * conservative about using the backup, and not trusting the meta.db
+ * as much as we do right now) */
+
+ meta_filename = dbs[TRACKER_DB_METADATA].abs_filename;
+
+ if (meta_filename) {
+ GFile *file;
+
+ file = g_file_new_for_path (meta_filename);
+ if (!g_file_query_exists (file, NULL)) {
+ GFile *parent, *backup;
+
+ parent = g_file_get_parent (file);
+ backup = g_file_get_child (parent, TRACKER_DB_BACKUP_META_FILENAME);
+
+ if (g_file_query_exists (backup, NULL)) {
+ g_file_move (backup, file, G_FILE_COPY_OVERWRITE, NULL,
+ NULL, NULL, NULL);
+ retval = TRUE;
+ }
+
+ g_object_unref (parent);
+ g_object_unref (backup);
+ }
+
+ g_object_unref (file);
+ }
+
+ return retval;
+}
+
gboolean
tracker_db_manager_init (TrackerDBManagerFlags flags,
gboolean *first_time,
@@ -1030,7 +1070,6 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
const gchar *env_path;
gboolean need_reindex;
guint i;
- const gchar *meta_filename;
if (first_time) {
*first_time = FALSE;
@@ -1129,37 +1168,8 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
- /* This is currently the only test for need_journal. We should add a
- * couple tests that test meta.db against consistenty, and if not
- * good, copy meta-backup.db over and set need_journal (being less
- * conservative about using the backup, and not trusting the meta.db
- * as much as we do right now) */
-
- meta_filename = dbs[TRACKER_DB_METADATA].abs_filename;
-
- if (meta_filename) {
- GFile *file;
-
- file = g_file_new_for_path (meta_filename);
- if (!g_file_query_exists (file, NULL)) {
- GFile *parent, *backup;
-
- parent = g_file_get_parent (file);
- backup = g_file_get_child (parent, TRACKER_DB_BACKUP_META_FILENAME);
-
- if (g_file_query_exists (backup, NULL)) {
- g_file_move (backup, file, G_FILE_COPY_OVERWRITE, NULL,
- NULL, NULL, NULL);
- if (need_journal) {
- *need_journal = TRUE;
- }
- }
-
- g_object_unref (parent);
- g_object_unref (backup);
- }
-
- g_object_unref (file);
+ if (need_journal) {
+ *need_journal = check_meta_backup ();
}
/* If we are just initializing to remove the databases,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]