[tracker/urho-sync] Several bugfixes in backup and restore
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/urho-sync] Several bugfixes in backup and restore
- Date: Thu, 20 Aug 2009 13:36:21 +0000 (UTC)
commit 18048eeda22eb94030a32e6f59e4c5ca0fa53579
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Aug 20 15:35:30 2009 +0200
Several bugfixes in backup and restore
src/libtracker-data/tracker-data-backup.c | 2 ++
src/libtracker-db/tracker-db-interface-sqlite.c | 2 ++
src/libtracker-db/tracker-db-journal.c | 3 +++
src/tracker-store/tracker-store.c | 6 ++++++
4 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 65bd255..4f2e79e 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -175,6 +175,7 @@ on_restore_done (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
+ tracker_db_journal_open ();
tracker_db_manager_reconnect ();
on_meta_copied (source_object, res, user_data);
@@ -240,6 +241,7 @@ tracker_data_backup_restore (GFile *backup,
BackupSaveInfo *info;
tracker_db_manager_disconnect ();
+ tracker_db_journal_close ();
info = g_new0 (BackupSaveInfo, 1);
info->destination = g_object_ref (backup);
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index c7f114a..5c8f2d3 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -222,9 +222,11 @@ close_database (TrackerDBInterfaceSqlitePrivate *priv)
g_slist_foreach (priv->function_data, (GFunc) g_free, NULL);
g_slist_free (priv->function_data);
+ priv->function_data = NULL;
g_slist_foreach (priv->aggregate_data, (GFunc) g_free, NULL);
g_slist_free (priv->aggregate_data);
+ priv->aggregate_data = NULL;
sqlite3_close (priv->db);
}
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index 408b2cb..1c7f79a 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -74,6 +74,7 @@ tracker_db_journal_truncate (void)
{
if (journal) {
ftruncate(fileno (journal), 0);
+ fsync (fileno (journal));
}
}
@@ -82,9 +83,11 @@ tracker_db_journal_close (void)
{
if (journal) {
fclose (journal);
+ journal = NULL;
}
g_free (filename);
+ filename = NULL;
}
gchar *
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 421c132..c1b234f 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -285,13 +285,19 @@ sync_idle_destroy (gpointer user_data)
void
tracker_store_play_journal (void)
{
+ TrackerStorePrivate *private;
gchar *lines;
+ private = g_static_private_get (&private_key);
+ g_return_if_fail (private != NULL);
+
lines = tracker_db_journal_get_content ();
if (lines) {
+ private->start_log = FALSE;
tracker_store_sparql_update (lines, NULL);
tracker_db_journal_truncate ();
+ private->start_log = TRUE;
g_free (lines);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]