Accepting request 963172 from GNOME:Next
New stable rel OBS-URL: https://build.opensuse.org/request/show/963172 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/tracker?expand=0&rev=228
This commit is contained in:
parent
37f7fa18dd
commit
e01096d97a
@ -1,174 +0,0 @@
|
||||
From 5883cebf8d7b2948bcb808162e78a4629ab3315c Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Garnacho <carlosg@gnome.org>
|
||||
Date: Mon, 8 Nov 2021 13:27:19 +0100
|
||||
Subject: [PATCH] libtracker-sparql: Handle query cancellation on
|
||||
TrackerEndpointDBus
|
||||
|
||||
Since the cursor contents are handed via a pipe FD, detect the situation
|
||||
where the other end of the pipe gets closed (say, client died or cancelled
|
||||
the operation) and cancel the DBus service side operation as well.
|
||||
|
||||
This avoids these operations from finishing to completion if they are
|
||||
going nowhere. Now that each pending query request gets its own cancellable,
|
||||
ensure these are also cancelled on TrackerEndpointDBus finalization.
|
||||
|
||||
Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/264
|
||||
---
|
||||
src/libtracker-sparql/tracker-endpoint-dbus.c | 68 ++++++++++++++++---
|
||||
1 file changed, 60 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c
|
||||
index 527e3f33a..d022c6f04 100644
|
||||
--- a/src/libtracker-sparql/tracker-endpoint-dbus.c
|
||||
+++ b/src/libtracker-sparql/tracker-endpoint-dbus.c
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <gio/gunixinputstream.h>
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <gio/gunixfdlist.h>
|
||||
+#include <glib-unix.h>
|
||||
|
||||
static const gchar introspection_xml[] =
|
||||
"<node>"
|
||||
@@ -86,6 +87,10 @@ typedef struct {
|
||||
TrackerEndpointDBus *endpoint;
|
||||
GDBusMethodInvocation *invocation;
|
||||
GDataOutputStream *data_stream;
|
||||
+ GCancellable *global_cancellable;
|
||||
+ GCancellable *cancellable;
|
||||
+ gulong cancellable_id;
|
||||
+ GSource *source;
|
||||
} QueryRequest;
|
||||
|
||||
typedef struct {
|
||||
@@ -175,6 +180,28 @@ tracker_endpoint_dbus_add_prologue (TrackerEndpointDBus *endpoint_dbus,
|
||||
}
|
||||
}
|
||||
|
||||
+static gboolean
|
||||
+fd_watch_cb (gint fd,
|
||||
+ GIOCondition condition,
|
||||
+ gpointer user_data)
|
||||
+{
|
||||
+ QueryRequest *request = user_data;
|
||||
+
|
||||
+ if ((condition & (G_IO_ERR | G_IO_HUP)) != 0) {
|
||||
+ g_cancellable_cancel (request->cancellable);
|
||||
+ return G_SOURCE_REMOVE;
|
||||
+ }
|
||||
+
|
||||
+ return G_SOURCE_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+propagate_cancelled (GCancellable *cancellable,
|
||||
+ GCancellable *connected_cancellable)
|
||||
+{
|
||||
+ g_cancellable_cancel (connected_cancellable);
|
||||
+}
|
||||
+
|
||||
static QueryRequest *
|
||||
query_request_new (TrackerEndpointDBus *endpoint,
|
||||
GDBusMethodInvocation *invocation,
|
||||
@@ -186,6 +213,21 @@ query_request_new (TrackerEndpointDBus *endpoint,
|
||||
request = g_new0 (QueryRequest, 1);
|
||||
request->invocation = g_object_ref (invocation);
|
||||
request->endpoint = endpoint;
|
||||
+ request->global_cancellable = g_object_ref (endpoint->cancellable);
|
||||
+ request->cancellable = g_cancellable_new ();
|
||||
+ request->cancellable_id =
|
||||
+ g_cancellable_connect (request->global_cancellable,
|
||||
+ G_CALLBACK (propagate_cancelled),
|
||||
+ g_object_ref (request->cancellable),
|
||||
+ g_object_unref);
|
||||
+
|
||||
+ request->source = g_unix_fd_source_new (fd, G_IO_ERR | G_IO_HUP);
|
||||
+
|
||||
+ g_source_set_callback (request->source,
|
||||
+ G_SOURCE_FUNC (fd_watch_cb),
|
||||
+ request,
|
||||
+ NULL);
|
||||
+ g_source_attach (request->source, g_main_context_get_thread_default ());
|
||||
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
buffered_stream = g_buffered_output_stream_new_sized (stream,
|
||||
@@ -204,6 +246,14 @@ query_request_new (TrackerEndpointDBus *endpoint,
|
||||
static void
|
||||
query_request_free (QueryRequest *request)
|
||||
{
|
||||
+ g_cancellable_disconnect (request->global_cancellable,
|
||||
+ request->cancellable_id);
|
||||
+ g_object_unref (request->global_cancellable);
|
||||
+
|
||||
+ g_source_destroy (request->source);
|
||||
+ g_source_unref (request->source);
|
||||
+ g_object_unref (request->cancellable);
|
||||
+
|
||||
g_output_stream_close (G_OUTPUT_STREAM (request->data_stream),
|
||||
NULL, NULL);
|
||||
|
||||
@@ -305,7 +355,7 @@ write_cursor (QueryRequest *request,
|
||||
values = g_new0 (const char *, n_columns);
|
||||
offsets = g_new0 (glong, n_columns);
|
||||
|
||||
- while (tracker_sparql_cursor_next (cursor, NULL, &inner_error)) {
|
||||
+ while (tracker_sparql_cursor_next (cursor, request->cancellable, &inner_error)) {
|
||||
glong cur_offset = -1;
|
||||
|
||||
if (!g_data_output_stream_put_int32 (request->data_stream, n_columns,
|
||||
@@ -397,8 +447,10 @@ finish_query (GObject *source_object,
|
||||
TrackerSparqlCursor *cursor = TRACKER_SPARQL_CURSOR (source_object);
|
||||
GError *error = NULL;
|
||||
|
||||
- if (!g_task_propagate_boolean (G_TASK (res), &error))
|
||||
- g_critical ("Error writing cursor: %s\n", error->message);
|
||||
+ if (!g_task_propagate_boolean (G_TASK (res), &error)) {
|
||||
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
+ g_critical ("Error writing cursor: %s\n", error->message);
|
||||
+ }
|
||||
|
||||
g_object_unref (cursor);
|
||||
g_clear_error (&error);
|
||||
@@ -423,7 +475,7 @@ query_cb (GObject *object,
|
||||
return;
|
||||
}
|
||||
|
||||
- task = g_task_new (cursor, request->endpoint->cancellable, finish_query, NULL);
|
||||
+ task = g_task_new (cursor, request->cancellable, finish_query, NULL);
|
||||
g_task_set_task_data (task, request, (GDestroyNotify) query_request_free);
|
||||
g_task_run_in_thread (task, handle_cursor_reply);
|
||||
g_object_unref (task);
|
||||
@@ -448,7 +500,7 @@ stmt_execute_cb (GObject *object,
|
||||
return;
|
||||
}
|
||||
|
||||
- task = g_task_new (cursor, request->endpoint->cancellable, finish_query, NULL);
|
||||
+ task = g_task_new (cursor, request->cancellable, finish_query, NULL);
|
||||
g_task_set_task_data (task, request, (GDestroyNotify) query_request_free);
|
||||
g_task_run_in_thread (task, handle_cursor_reply);
|
||||
g_object_unref (task);
|
||||
@@ -645,11 +697,11 @@ endpoint_dbus_iface_method_call (GDBusConnection *connection,
|
||||
TrackerSparqlStatement *stmt;
|
||||
|
||||
stmt = create_statement (conn, query, arguments,
|
||||
- endpoint_dbus->cancellable,
|
||||
+ request->cancellable,
|
||||
&error);
|
||||
if (stmt) {
|
||||
tracker_sparql_statement_execute_async (stmt,
|
||||
- endpoint_dbus->cancellable,
|
||||
+ request->cancellable,
|
||||
stmt_execute_cb,
|
||||
request);
|
||||
/* Statements are single use here... */
|
||||
@@ -662,7 +714,7 @@ endpoint_dbus_iface_method_call (GDBusConnection *connection,
|
||||
} else {
|
||||
tracker_sparql_connection_query_async (conn,
|
||||
query,
|
||||
- endpoint_dbus->cancellable,
|
||||
+ request->cancellable,
|
||||
query_cb,
|
||||
request);
|
||||
}
|
||||
--
|
||||
GitLab
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1847e08b39e6e61d848735aa1f97f7d96c038201653fa0d7cb9e81b37eb9c03a
|
||||
size 1947304
|
3
tracker-3.3.0.tar.xz
Normal file
3
tracker-3.3.0.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0706f96fe7f95df42acec812c1de7b4593a0d648321ca83506a9d71e22417bda
|
||||
size 1969132
|
@ -1,119 +0,0 @@
|
||||
From ad0f8ab4a83cb8ecd2bb55619d06cc6544e45f7d Mon Sep 17 00:00:00 2001
|
||||
From: Carlos Garnacho <carlosg@gnome.org>
|
||||
Date: Sun, 7 Nov 2021 13:54:01 +0100
|
||||
Subject: [PATCH] libtracker-sparql: Fix actual 0-path matches in ? and * path
|
||||
operators
|
||||
|
||||
These operators ("zero or one" and "zero or more" respectively) so far have
|
||||
worked on the prerequisite that the contained property path has at least
|
||||
one match with the given constraints. E.g.:
|
||||
|
||||
SELECT ?u { <URI> nie:interpretedAs? ?u }
|
||||
|
||||
Would return no results if the given uri had no nie:interpretedAs, but here
|
||||
we still want to have the 0-length match, regardless of there being a match
|
||||
or not.
|
||||
|
||||
This commit fixes this by making these common table expressions look for
|
||||
"self" in the rdfs:Resource table, this is ensured to always match as long
|
||||
as the resource exists.
|
||||
|
||||
Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/337
|
||||
---
|
||||
src/libtracker-data/tracker-sparql.c | 43 ++++++++++++++++++++++++----
|
||||
1 file changed, 37 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
|
||||
index d12786e45..f6d42228a 100644
|
||||
--- a/src/libtracker-data/tracker-sparql.c
|
||||
+++ b/src/libtracker-data/tracker-sparql.c
|
||||
@@ -895,10 +895,42 @@ _prepend_path_element (TrackerSparql *sparql,
|
||||
{
|
||||
TrackerStringBuilder *old;
|
||||
gchar *table_name, *graph_column;
|
||||
+ gchar *zero_length_match = NULL;
|
||||
|
||||
if (path_elem->op == TRACKER_PATH_OPERATOR_NONE &&
|
||||
tracker_token_is_empty (&sparql->current_state->graph)) {
|
||||
tracker_sparql_add_union_graph_subquery (sparql, path_elem->data.property);
|
||||
+ } else if (path_elem->op == TRACKER_PATH_OPERATOR_ZEROORONE ||
|
||||
+ path_elem->op == TRACKER_PATH_OPERATOR_ZEROORMORE) {
|
||||
+ const gchar *graph;
|
||||
+
|
||||
+ graph = tracker_token_get_idstring (&sparql->current_state->graph);
|
||||
+
|
||||
+ if (tracker_token_is_empty (&sparql->current_state->graph) ||
|
||||
+ tracker_token_get_variable (&sparql->current_state->graph)) {
|
||||
+ TrackerOntologies *ontologies;
|
||||
+ TrackerClass *rdfs_resource;
|
||||
+
|
||||
+ ontologies = tracker_data_manager_get_ontologies (sparql->data_manager);
|
||||
+ rdfs_resource = tracker_ontologies_get_class_by_uri (ontologies, RDFS_NS "Resource");
|
||||
+ tracker_sparql_add_union_graph_subquery_for_class (sparql,
|
||||
+ rdfs_resource);
|
||||
+
|
||||
+ zero_length_match = g_strdup_printf ("SELECT ID, ID, graph, %d, %d "
|
||||
+ "FROM \"unionGraph_rdfs:Resource\"",
|
||||
+ TRACKER_PROPERTY_TYPE_RESOURCE,
|
||||
+ TRACKER_PROPERTY_TYPE_RESOURCE);
|
||||
+ } else if (tracker_sparql_find_graph (sparql, graph)) {
|
||||
+ zero_length_match = g_strdup_printf ("SELECT ID, ID, %d, %d, %d "
|
||||
+ "FROM \"%s\".\"rdfs:Resource\"",
|
||||
+ tracker_sparql_find_graph (sparql, graph),
|
||||
+ TRACKER_PROPERTY_TYPE_RESOURCE,
|
||||
+ TRACKER_PROPERTY_TYPE_RESOURCE,
|
||||
+ graph);
|
||||
+ } else {
|
||||
+ /* Graph does not exist, ensure to come back empty */
|
||||
+ zero_length_match = g_strdup ("SELECT * FROM (SELECT 0 AS ID, NULL, NULL, 0, 0 LIMIT 0)");
|
||||
+ }
|
||||
}
|
||||
|
||||
old = tracker_sparql_swap_builder (sparql, sparql->current_state->with_clauses);
|
||||
@@ -991,14 +1023,13 @@ _prepend_path_element (TrackerSparql *sparql,
|
||||
"(SELECT ID, value, graph, ID_type, value_type "
|
||||
"FROM \"%s_helper\" "
|
||||
"UNION "
|
||||
- "SELECT ID, ID, graph, ID_type, ID_type "
|
||||
- "FROM \"%s\" "
|
||||
+ "%s "
|
||||
"UNION "
|
||||
"SELECT value, value, graph, value_type, value_type "
|
||||
"FROM \"%s\") ",
|
||||
path_elem->name,
|
||||
path_elem->name,
|
||||
- path_elem->data.composite.child1->name,
|
||||
+ zero_length_match,
|
||||
path_elem->data.composite.child1->name);
|
||||
break;
|
||||
case TRACKER_PATH_OPERATOR_ONEORMORE:
|
||||
@@ -1018,8 +1049,7 @@ _prepend_path_element (TrackerSparql *sparql,
|
||||
case TRACKER_PATH_OPERATOR_ZEROORONE:
|
||||
_append_string_printf (sparql,
|
||||
"\"%s\" (ID, value, graph, ID_type, value_type) AS "
|
||||
- "(SELECT ID, ID, graph, ID_type, ID_type "
|
||||
- "FROM \"%s\" "
|
||||
+ "(%s "
|
||||
"UNION "
|
||||
"SELECT ID, value, graph, ID_type, value_type "
|
||||
"FROM \"%s\" "
|
||||
@@ -1027,7 +1057,7 @@ _prepend_path_element (TrackerSparql *sparql,
|
||||
"SELECT value, value, graph, value_type, value_type "
|
||||
"FROM \"%s\") ",
|
||||
path_elem->name,
|
||||
- path_elem->data.composite.child1->name,
|
||||
+ zero_length_match,
|
||||
path_elem->data.composite.child1->name,
|
||||
path_elem->data.composite.child1->name);
|
||||
break;
|
||||
@@ -1075,6 +1105,7 @@ _prepend_path_element (TrackerSparql *sparql,
|
||||
}
|
||||
|
||||
tracker_sparql_swap_builder (sparql, old);
|
||||
+ g_free (zero_length_match);
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
--
|
||||
GitLab
|
||||
|
@ -1,3 +1,60 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun Mar 20 07:54:49 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
- Update to version 3.3.0:
|
||||
+ Fix storage of subsecond information in date/time properties.
|
||||
+ Add more tests.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 7 12:04:33 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
- Update to version 3.3.0.rc:
|
||||
+ Fix cursor column names for date and resource types.
|
||||
+ Fix possible crasher.
|
||||
+ Added non-installable benchmark utility.
|
||||
+ Added build option to pick libsoup versions to build support
|
||||
for.
|
||||
+ Added build option to disable tests.
|
||||
+ Fixed generation of man pages with newer asciidoc.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 14 17:15:38 UTC 2022 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
- Update to version 3.3.0.beta:
|
||||
+ Add API to serialize data into various RDF formats
|
||||
+ Add API to map a TrackerSparqlConnection as a SERVICE of
|
||||
another TrackerSparqlConnection
|
||||
+ Fixed possible warnings and missed notifications in
|
||||
TrackerNotifier
|
||||
+ Updated "tracker3 export" to use serialization API
|
||||
+ Documentation fixes
|
||||
+ Added internal TrackerRowid type to represent ROWIDs
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 10 13:54:09 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||
|
||||
- Update to version 3.3.0.alpha:
|
||||
+ Add more specific error codes for problems found updating a
|
||||
database to new ontology changes.
|
||||
+ Add method to create a TrackerStatement from a GResource file
|
||||
+ Fix 0-len matches in ? and * property path operators
|
||||
+ Handle query cancellation in TrackerEndpointDBus
|
||||
+ Consistency fixes to TrackerSparqlStatement API in all
|
||||
connection types
|
||||
+ Deprecate tracker_namespace_manager_get_default(), use
|
||||
tracker_sparql_connection_get_namespace_manager() instead
|
||||
+ Fix rare crash when concurrently querying the database while
|
||||
a graph is being created/deleted.
|
||||
+ Add TRACKER_SPARQL_CONNECTION_ANONYMOUS_BNODES flag to
|
||||
optionally enable a treatment of blank nodes that is
|
||||
compliant with the SPARQL 1.1 specs.
|
||||
+ Documentation improvements
|
||||
+ Fix spurious locking errors with in-memory databases
|
||||
+ Fixes to CLI tools detection on NixOS
|
||||
+ Updated translations.
|
||||
- Drop tracker-fix-actual-0-path-matches.patch and
|
||||
5883cebf8d7b2948bcb808162e78a4629ab3315c.patch: fixed upstream.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 12 20:59:27 UTC 2021 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
|
10
tracker.spec
10
tracker.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package tracker
|
||||
#
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
# Copyright (c) 2010 Luis Medinas, Portugal
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
@ -21,17 +21,13 @@
|
||||
%define RPMTrackerAPI 3_0
|
||||
|
||||
Name: tracker
|
||||
Version: 3.2.1
|
||||
Version: 3.3.0
|
||||
Release: 0
|
||||
Summary: Object database, tag/metadata database, search tool and indexer
|
||||
License: GPL-2.0-or-later
|
||||
Group: Productivity/Other
|
||||
URL: https://wiki.gnome.org/Projects/Tracker
|
||||
Source0: https://download.gnome.org/sources/tracker/3.2/%{name}-%{version}.tar.xz
|
||||
# PATCH-FIX-UPSTREAM tracker-fix-actual-0-path-matches.patch bsc#1191207, glgo#GNOME/tracker#337 alynx.zhou@suse.com -- Fix no metadata available when using tracker3 info
|
||||
Patch1: tracker-fix-actual-0-path-matches.patch
|
||||
# PATCH-FIX-UPSTREAM 5883cebf8d7b2948bcb808162e78a4629ab3315c.patch -- libtracker-sparql: Handle query cancellation on TrackerEndpointDBus
|
||||
Patch2: https://gitlab.gnome.org/GNOME/tracker/-/commit/5883cebf8d7b2948bcb808162e78a4629ab3315c.patch
|
||||
Source0: https://download.gnome.org/sources/tracker/3.3/%{name}-%{version}.tar.xz
|
||||
|
||||
BuildRequires: asciidoc
|
||||
BuildRequires: fdupes
|
||||
|
Loading…
x
Reference in New Issue
Block a user