Merge lp:~ted/url-dispatcher/recoverable-inserts into lp:url-dispatcher/14.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 56
Merged at revision: 55
Proposed branch: lp:~ted/url-dispatcher/recoverable-inserts
Merge into: lp:url-dispatcher/14.10
Diff against target: 120 lines (+40/-7)
5 files modified
service/dispatcher.c (+1/-1)
service/recoverable-problem.c (+1/-1)
service/recoverable-problem.h (+1/-1)
service/update-directory.c (+36/-3)
tests/recoverable-problem-mock.c (+1/-1)
To merge this branch: bzr merge lp:~ted/url-dispatcher/recoverable-inserts
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+222058@code.launchpad.net

Commit message

Recoverable errors on DB errors on update

Description of the change

Add some recoverable errors

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
55. By Ted Gould

Update to trunk

56. By Ted Gould

Const our strings

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

The patch looks fine; approving.

As an aside, a couple of things stand out to me when reading this:

1. The scaffolding for building the key/value pairs is kind of clumsy. When we create a 'standard' version of recoverable errors and remove the copied files from the various projects, maybe report_recoverable_problem() should end in a ... with an __attribute__ ((__sentinel__)) in the prototype.

2. I'm surprised I hadn't noticed this before, but "motification"? :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'service/dispatcher.c'
2--- service/dispatcher.c 2014-05-26 12:56:47 +0000
3+++ service/dispatcher.c 2014-06-04 16:03:47 +0000
4@@ -72,7 +72,7 @@
5 g_variant_unref(pid_tuple);
6
7 gchar * signature = g_strdup_printf("url-dispatcher;bad-url;%s", badurl);
8- gchar * additional[3] = {
9+ const gchar * additional[3] = {
10 "BadURL",
11 badurl,
12 NULL
13
14=== modified file 'service/recoverable-problem.c'
15--- service/recoverable-problem.c 2013-09-19 17:01:34 +0000
16+++ service/recoverable-problem.c 2014-06-04 16:03:47 +0000
17@@ -61,7 +61,7 @@
18
19 /* Code to report an error */
20 void
21-report_recoverable_problem (const gchar * signature, GPid report_pid, gboolean wait, gchar * additional_properties[])
22+report_recoverable_problem (const gchar * signature, GPid report_pid, gboolean wait, const gchar * additional_properties[])
23 {
24 GError * error = NULL;
25 gint error_stdin = 0;
26
27=== modified file 'service/recoverable-problem.h'
28--- service/recoverable-problem.h 2013-09-16 20:56:28 +0000
29+++ service/recoverable-problem.h 2014-06-04 16:03:47 +0000
30@@ -22,5 +22,5 @@
31 void report_recoverable_problem (const gchar * signature,
32 GPid report_pid,
33 gboolean wait,
34- gchar * additional_properties[]);
35+ const gchar * additional_properties[]);
36
37
38=== modified file 'service/update-directory.c'
39--- service/update-directory.c 2014-03-14 19:47:07 +0000
40+++ service/update-directory.c 2014-06-04 16:03:47 +0000
41@@ -55,7 +55,22 @@
42 return;
43 }
44
45- url_db_insert_url(urldata->db, urldata->filename, protocol, suffix);
46+ if (!url_db_insert_url(urldata->db, urldata->filename, protocol, suffix)) {
47+ const gchar * additional[7] = {
48+ "Filename",
49+ NULL,
50+ "Protocol",
51+ NULL,
52+ "Suffix",
53+ NULL,
54+ NULL
55+ };
56+ additional[1] = urldata->filename;
57+ additional[3] = protocol;
58+ additional[5] = suffix;
59+
60+ report_recoverable_problem("url-dispatcher-update-sqlite-insert-error", 0, TRUE, additional);
61+ }
62 }
63
64 static void
65@@ -115,7 +130,17 @@
66 }
67 }
68
69- url_db_set_file_motification_time(db, filename, &filetime);
70+ if (!url_db_set_file_motification_time(db, filename, &filetime)) {
71+ const gchar * additional[7] = {
72+ "Filename",
73+ NULL,
74+ NULL
75+ };
76+ additional[1] = filename;
77+
78+ report_recoverable_problem("url-dispatcher-update-sqlite-fileupdate-error", 0, TRUE, additional);
79+ return FALSE;
80+ }
81
82 return TRUE;
83 }
84@@ -128,6 +153,14 @@
85 g_debug(" Removing file: %s", filename);
86 if (!url_db_remove_file((sqlite3*)user_data, filename)) {
87 g_warning("Unable to remove file: %s", filename);
88+ const gchar * additional[3] = {
89+ "Filename",
90+ NULL,
91+ NULL
92+ };
93+ additional[1] = filename;
94+
95+ report_recoverable_problem("url-dispatcher-update-remove-file-error", 0, TRUE, additional);
96 }
97 }
98
99@@ -198,7 +231,7 @@
100
101 int close_status = sqlite3_close(db);
102 if (close_status != SQLITE_OK) {
103- gchar * additional[3] = {
104+ const gchar * additional[3] = {
105 "SQLiteStatus",
106 NULL,
107 NULL
108
109=== modified file 'tests/recoverable-problem-mock.c'
110--- tests/recoverable-problem-mock.c 2013-09-26 15:27:55 +0000
111+++ tests/recoverable-problem-mock.c 2014-06-04 16:03:47 +0000
112@@ -21,7 +21,7 @@
113 #include "recoverable-problem.h"
114
115 void
116-report_recoverable_problem (const gchar * signature, GPid report_pid, gboolean wait, gchar * additional_properties[])
117+report_recoverable_problem (const gchar * signature, GPid report_pid, gboolean wait, const gchar * additional_properties[])
118 {
119
120 return;

Subscribers

People subscribed via source and target branches