[tracker/error-handling: 3/6] Temporary commit, handling out of space errors. This is a bit ugly. Perhaps refactor?



commit 277b6ce86a149847aa6395ce5dc5d2675bbf0ea4
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Feb 8 17:28:52 2011 +0100

    Temporary commit, handling out of space errors. This is a bit ugly. Perhaps refactor?

 src/libtracker-data/tracker-data-update.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 9d4b2d5..2446fc9 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -162,6 +162,7 @@ static GPtrArray *commit_callbacks = NULL;
 static GPtrArray *rollback_callbacks = NULL;
 static gint max_service_id = 0;
 static gint max_ontology_id = 0;
+static gboolean commit_failed = FALSE;
 
 static gint         ensure_resource_id      (const gchar      *uri,
                                              gboolean         *create);
@@ -2516,6 +2517,7 @@ tracker_data_commit_transaction (GError **error)
 	                                         &actual_error);
 
 	if (actual_error) {
+		commit_failed = TRUE;
 		g_propagate_error (error, actual_error);
 		return;
 	}
@@ -2588,7 +2590,11 @@ tracker_data_rollback_transaction (void)
 	iface = tracker_db_manager_get_db_interface ();
 
 	tracker_data_update_buffer_clear ();
-	tracker_db_interface_execute_query (iface, NULL, "ROLLBACK");
+	if (!commit_failed) {
+		tracker_db_interface_execute_query (iface, NULL, "ROLLBACK");
+		commit_failed = FALSE;
+	}
+
 	tracker_db_interface_execute_query (iface, NULL, "PRAGMA cache_size = %d", TRACKER_DB_CACHE_SIZE_DEFAULT);
 	tracker_db_journal_rollback_transaction ();
 



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