[tracker/error-handling] libtracker-data: Don't let journal replay continue when out of disk-space
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/error-handling] libtracker-data: Don't let journal replay continue when out of disk-space
- Date: Wed, 9 Feb 2011 12:42:05 +0000 (UTC)
commit 7abaf42293cbb671b40dba6e0f47c4b848062010
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Feb 9 13:40:01 2011 +0100
libtracker-data: Don't let journal replay continue when out of disk-space
src/libtracker-data/tracker-data-manager.c | 15 ++++++++++++++-
src/libtracker-data/tracker-data-update.c | 14 +++++++++++---
src/libtracker-data/tracker-data-update.h | 3 ++-
3 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 515777d..95f75b2 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -3902,9 +3902,22 @@ tracker_data_manager_init (TrackerDBManagerFlags flags,
/* Start replay */
tracker_data_replay_journal (busy_callback,
busy_user_data,
- busy_status);
+ busy_status,
+ &internal_error);
g_free (busy_status);
+ if (internal_error) {
+
+ if (g_error_matches (internal_error, TRACKER_DB_INTERFACE_ERROR, TRACKER_DB_NO_SPACE)) {
+ tracker_db_manager_remove_all (FALSE);
+ tracker_db_manager_shutdown ();
+ tracker_db_journal_shutdown ();
+ }
+
+ g_propagate_error (error, internal_error);
+ return FALSE;
+ }
+
in_journal_replay = FALSE;
/* open journal for writing */
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 4f0a814..64359a1 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2685,9 +2685,10 @@ tracker_data_sync (void)
}
void
-tracker_data_replay_journal (TrackerBusyCallback busy_callback,
- gpointer busy_user_data,
- const gchar *busy_status)
+tracker_data_replay_journal (TrackerBusyCallback busy_callback,
+ gpointer busy_user_data,
+ const gchar *busy_status,
+ GError **error)
{
GError *journal_error = NULL;
TrackerProperty *rdf_type = NULL;
@@ -2739,6 +2740,13 @@ tracker_data_replay_journal (TrackerBusyCallback busy_callback,
if (new_error) {
tracker_data_rollback_journal_transaction ();
g_warning ("Journal replay error: '%s'", new_error->message);
+
+ /* Oud of disk is an unrecoverable fatal error */
+ if (g_error_matches (new_error, TRACKER_DB_INTERFACE_ERROR, TRACKER_DB_NO_SPACE)) {
+ g_propagate_error (error, new_error);
+ return;
+ }
+
g_clear_error (&new_error);
}
} else if (type == TRACKER_DB_JOURNAL_INSERT_STATEMENT) {
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 2137541..37399f3 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -89,7 +89,8 @@ void tracker_data_load_turtle_file (GFile *
void tracker_data_sync (void);
void tracker_data_replay_journal (TrackerBusyCallback busy_callback,
gpointer busy_user_data,
- const gchar *busy_status);
+ const gchar *busy_status,
+ GError **error);
/* Calling back */
void tracker_data_add_insert_statement_callback (TrackerStatementCallback callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]