[tracker/wip/carlosg/update-perf: 72/72] libtracker-sparql: Avoid spurious warnings writing D-Bus endpoint cursor
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 72/72] libtracker-sparql: Avoid spurious warnings writing D-Bus endpoint cursor
- Date: Tue, 30 Aug 2022 15:39:42 +0000 (UTC)
commit 3487ebf90f01f4f97df6cac208cbe0b3d63c26be
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Aug 22 16:37:34 2022 +0200
libtracker-sparql: Avoid spurious warnings writing D-Bus endpoint cursor
Sometimes if the other end closes prematurely, the cursor gets cancelled
and end up as an "Interrupted" error. Make that error more consistent by
using G_IO_ERROR_CANCELLED, and avoid issuing a warning in those situations.
Fixes some sporadic warnings seen in the serialize test.
.../core/tracker-db-interface-sqlite.c | 30 +++++++++++-----------
src/libtracker-sparql/tracker-endpoint-dbus.c | 3 ++-
2 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
index 2c98f153e..dd3455221 100644
--- a/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
+++ b/src/libtracker-sparql/core/tracker-db-interface-sqlite.c
@@ -3350,29 +3350,29 @@ db_cursor_iter_next (TrackerDBCursor *cursor,
tracker_db_interface_lock (iface);
- if (g_cancellable_is_cancelled (cancellable)) {
- result = SQLITE_INTERRUPT;
+ if (g_cancellable_set_error_if_cancelled (cancellable, error)) {
sqlite3_reset (cursor->stmt);
+ cursor->finished = TRUE;
} else {
/* only one statement can be active at the same time per interface */
iface->cancellable = cancellable;
result = stmt_step (cursor->stmt);
iface->cancellable = NULL;
- }
- if (result == SQLITE_INTERRUPT) {
- g_set_error (error,
- TRACKER_DB_INTERFACE_ERROR,
- TRACKER_DB_INTERRUPTED,
- "Interrupted");
- } else if (result != SQLITE_ROW && result != SQLITE_DONE) {
- g_set_error (error,
- TRACKER_DB_INTERFACE_ERROR,
- TRACKER_DB_QUERY_ERROR,
- "%s", sqlite3_errmsg (iface->db));
- }
+ if (result == SQLITE_INTERRUPT) {
+ g_set_error (error,
+ TRACKER_DB_INTERFACE_ERROR,
+ TRACKER_DB_INTERRUPTED,
+ "Interrupted");
+ } else if (result != SQLITE_ROW && result != SQLITE_DONE) {
+ g_set_error (error,
+ TRACKER_DB_INTERFACE_ERROR,
+ TRACKER_DB_QUERY_ERROR,
+ "%s", sqlite3_errmsg (iface->db));
+ }
- cursor->finished = (result != SQLITE_ROW);
+ cursor->finished = (result != SQLITE_ROW);
+ }
tracker_db_interface_unlock (iface);
}
diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c
index f609adb52..8ee65a3f4 100644
--- a/src/libtracker-sparql/tracker-endpoint-dbus.c
+++ b/src/libtracker-sparql/tracker-endpoint-dbus.c
@@ -441,7 +441,8 @@ handle_cursor_reply (GTask *task,
g_dbus_method_invocation_return_value (request->invocation, g_variant_new ("(^as)", variable_names));
- if (!write_cursor (request, cursor, &write_error))
+ if (!write_cursor (request, cursor, &write_error) &&
+ !g_error_matches (write_error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Endpoint failed to fully write cursor: %s\n", write_error->message);
g_free (variable_names);
g_clear_error (&write_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]