| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
If for some reason uncrustify gets angry at our file and indent on/off
marks, it will result in an error code other than 0. Since in those
cases there is no output to diff with, we misinterpret those situations
as "the whole file should be deleted", which is far from it.
|
|\
| |
| |
| |
| | |
libtracker-sparql: Fix some printf format strings
See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/556
|
|/
|
|
|
| |
The size of GSize varies between 64bit and 32bit systems so always use
G_GSIZE_FORMAT instead of `%ld`.
|
|\
| |
| |
| |
| | |
core: Move more transient TrackerSparql data into TrackerSparqlState
See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/550
|
| |
| |
| |
| |
| |
| | |
The TrackerSparql object no longer directly contains data that
needs to be dropped if rebuilding the SQL query from SPARQL. This
function now does nothing, so can be removed.
|
| |
| |
| |
| |
| | |
Now we can avoid keeping this context for long, so move this piece of
data to the transient TrackerSparqlState.
|
| |
| |
| |
| |
| |
| |
| |
| | |
After done with query processing, we can keep just small pieces of
the TrackerSelectContext data for the (possibly repeatable) query
execution step. Move this data to the TrackerSparql, so we can move
the TrackerSelectContext to the more transient TrackerSparqlState
struct and stick to the essential data.
|
| |
| |
| |
| |
| |
| |
| | |
We do that, but at the same time we postpone the resulting error
until tracker_sparql_execute_cursor(), we can just rely on the paths
that are already there for possibly regenerating the SQL string out
of the SPARQL string.
|
| |
| |
| |
| |
| | |
We just need to track this state while parsing the SPARQL string, this
can be moved to TrackerSparqlState.
|
| |
| |
| |
| | |
It was still using a word we agreed on avoiding.
|
| |
| |
| |
| |
| |
| |
| | |
After all the query is parsed, we can stick to the resulting SQL string as
a gchar*, if/until the query needs to be entirely redone from the initial
SPARQL. This means we can move the TrackerStringBuilder itself to be
temporary state.
|
| |
| |
| |
| | |
This is only needed while parsing the query, so can be moved there.
|
| |
| |
| |
| |
| |
| | |
Now that we have a tracker_sparql_state_init() function to initialize
the TrackerSparqlState, we can fetch the root node of the parser tree
there.
|
| |
| |
| |
| |
| | |
This is only needed while parsing the query, so can be moved to
TrackerSparqlState.
|
| |
| |
| |
| |
| | |
We just need these supporting hashtables while parsing the query, so
these can be moved into TrackerSparqlState.
|
| |
| |
| |
| |
| |
| | |
This is not needed after query parsing, so can be pushed there.
As this state needs some initialization, add a tracker_sparql_state_init()
function to deal with that.
|
|/
|
|
|
| |
This is only used while parsing, and is not necessary to preserve with
the (possibly long-lived) TrackerSparql object.
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
libtracker-sparql: Close descriptors asynchronously in TrackerEndpointDBus
Closes #386
See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/551
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Even though the updates were being read chunk by chunk asynchronously,
it was still the thread/context that spawned the TrackerEndpointDBus
what is driving the operation by reading the next chunk, or issuing
the update after everything was read.
Delegate the whole FD reading to a task in a thread, so it does not
need to be driven by the (possibly main) context managing the endpoint.
The update is still issued from this thread, mainly to share the
FD reading bits between normal and blank node updates.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The QueryRequest and UpdateRequest internal data structures may be freed from
the thread that is handling endpoint requests. Avoid closing descriptors from
that thread, this is esp. important with the write FDs since there might be
data pending to be written and flushed, so it may be a time consuming operation,
or it may even stall if the peer is busy with other things.
Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/386
|
|\ \
| |/
|/|
| |
| |
| |
| | |
core: Handle ROWIDs turned into strings in SparqlPrintIRI()
Closes #387
See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/552
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Even though normally we expect ROWIDs to preserve numeric affinity
when we proceed to print their IRI in the higher parts of the query,
it is not guaranteed by the SQLite documentation:
"Whether or not a persistent internal datatype conversion occurs
is undefined and may change from one release of SQLite to the next."
And this in fact changed for the core/property-paths/alternative-path-3
unit test, where it does the '|' union of text and resource (i.e. ROWIDs)
properties. Since SQLite 3.40.0, the SparqlPrintIRI() happening in the
topmost select will get SQLITE_TEXT affinity for all ROWID values received
through the union.
In order to work with both older and newer version of SQLite, attempt to
force integer affinity so ROWID IRIs are correctly resolved instead of
being interpreted as IRI strings.
Closes: https://gitlab.gnome.org/GNOME/tracker/-/issues/387
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The IRIs being inserted in the triple store should be ensured to be
correct, full IRIs. Perform the minimal check here, and warn if
the IRI does not at least contain a scheme separator.
This at least will raise some warnings if invalid IRIs like <123> or
<abc> are inserted by the Tracker user, it will be turned into a
GError worthy condition in future versions.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| |
| |
| | |
If we got an error, we want to break early of this loop, otherwise
we'll reuse the already set GError and fall into further warnings that
might obscure the original issue.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
| |
| |
| | |
Do not rely on our loose interpretation of IRIs to make tests work.
|
|/
|
|
| |
Do not rely on our loose interpretation of IRIs to make tests work.
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| | |
Fixes for issues detected by valgrind
See merge request https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/549
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Our update log is a fixed size, we (usually) try hard that it remains
within it, and avoid GArray resizes which in turn result in GHashTable
entries suddenly pointing to invalid memory.
This however may break if many multivalued property additions on the
same graph/subject/predicate happen. This is seen in valgrind as:
==477545== Invalid read of size 8
==477545== at 0x4C67E9A: tracker_data_log_entry_equal (tracker-data-update.c:231)
==477545== by 0x48E4AF1: UnknownInlinedFun (ghash.c:495)
==477545== by 0x48E4AF1: g_hash_table_lookup (ghash.c:1540)
==477545== by 0x4C685F7: log_entry_for_single_value_property (tracker-data-update.c:768)
==477545== by 0x4C6A4A4: cache_insert_metadata_decomposed (tracker-data-update.c:2215)
==477545== by 0x4C6C1DD: tracker_data_insert_statement_with_string (tracker-data-update.c:2922)
==477545== by 0x4C6C400: tracker_data_insert_statement (tracker-data-update.c:2826)
==477545== by 0x4C8F94D: tracker_sparql_apply_quad (tracker-sparql.c:2239)
==477545== by 0x4C8FC66: translate_GraphNode (tracker-sparql.c:7466)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C82636: translate_Object (tracker-sparql.c:6537)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C89655: translate_ObjectList (tracker-sparql.c:6522)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C8C47D: translate_PropertyListNotEmpty (tracker-sparql.c:6491)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C82995: translate_TriplesSameSubject (tracker-sparql.c:6406)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84E3E: translate_TriplesTemplate (tracker-sparql.c:5206)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== Address 0x8688768 is 104 bytes inside a block of size 4,096 free'd
==477545== at 0x48466AF: realloc (vg_replace_malloc.c:1437)
==477545== by 0x49095BF: g_realloc (gmem.c:201)
==477545== by 0x48CEF52: g_array_maybe_expand (garray.c:1000)
==477545== by 0x48CF2DF: g_array_append_vals (garray.c:528)
==477545== by 0x4C68797: log_entry_for_multi_value_property (tracker-data-update.c:748)
==477545== by 0x4C6A433: cache_insert_metadata_decomposed (tracker-data-update.c:2211)
==477545== by 0x4C6BFF9: tracker_data_insert_statement_with_uri (tracker-data-update.c:2880)
==477545== by 0x4C6C497: tracker_data_insert_statement (tracker-data-update.c:2824)
==477545== by 0x4C8F94D: tracker_sparql_apply_quad (tracker-sparql.c:2239)
==477545== by 0x4C8FC66: translate_GraphNode (tracker-sparql.c:7466)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C82636: translate_Object (tracker-sparql.c:6537)
==477545== by 0x4C89769: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C89769: translate_ObjectList (tracker-sparql.c:6525)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C8C47D: translate_PropertyListNotEmpty (tracker-sparql.c:6491)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C82995: translate_TriplesSameSubject (tracker-sparql.c:6406)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84E3E: translate_TriplesTemplate (tracker-sparql.c:5206)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== by 0x4C84ECF: translate_TriplesTemplate (tracker-sparql.c:5210)
==477545== by 0x4C8219F: _call_rule_func (tracker-sparql.c:9805)
==477545== Block was alloc'd at
==477545== at 0x484178A: malloc (vg_replace_malloc.c:380)
==477545== by 0x484670B: realloc (vg_replace_malloc.c:1437)
==477545== by 0x49095BF: g_realloc (gmem.c:201)
==477545== by 0x48CEF52: g_array_maybe_expand (garray.c:1000)
==477545== by 0x48CF07C: g_array_sized_new (garray.c:287)
==477545== by 0x4C6C942: tracker_data_begin_transaction (tracker-data-update.c:3056)
==477545== by 0x4C6C995: tracker_data_begin_ontology_transaction (tracker-data-update.c:3081)
==477545== by 0x4C63F2E: tracker_data_manager_initable_init (tracker-data-manager.c:4317)
==477545== by 0x4C9E724: tracker_direct_connection_initable_init (tracker-direct.c:493)
==477545== by 0x4A656B7: g_initable_new_valist (ginitable.c:250)
==477545== by 0x4A657AC: g_initable_new (ginitable.c:164)
==477545== by 0x4C9F5AB: tracker_direct_connection_new (tracker-direct.c:1562)
==477545== by 0x4C47D20: tracker_sparql_connection_new (tracker-connection.c:1025)
==477545== by 0x40AF7B: setup_connection_and_endpoint (tracker-main.c:823)
==477545== by 0x40AF7B: main (tracker-main.c:1062)
Ensure to flush harder, even if the resource would stay the same, this avoids the
log array from growing past this fixed limit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The hashtable destroy functions may result in the TrackerDBStatement being
freed, so trying to access the MRU head after that will result in invalid
memory access, seen in valgrind as:
==477545== Invalid write of size 8
==477545== at 0x4C71DF9: tracker_db_statement_mru_insert (tracker-db-interface-sqlite.c:2656)
==477545== by 0x4C6AFF8: tracker_data_ensure_update_statement (tracker-data-update.c:1219)
==477545== by 0x4C6AFF8: tracker_data_flush_log (tracker-data-update.c:1242)
==477545== by 0x4C6AFF8: tracker_data_update_buffer_flush (tracker-data-update.c:1550)
==477545== by 0x4C6BA79: tracker_data_update_buffer_might_flush (tracker-data-update.c:1605)
==477545== by 0x4C6BADF: resource_buffer_switch (tracker-data-update.c:2534)
==477545== by 0x4C6BF2C: tracker_data_insert_statement_with_uri (tracker-data-update.c:2857)
==477545== by 0x4C6C497: tracker_data_insert_statement (tracker-data-update.c:2824)
==477545== by 0x4C6D897: update_resource_property (tracker-data-update.c:3489)
==477545== by 0x4C6D4C4: update_resource_single (tracker-data-update.c:3554)
==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442)
==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593)
==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442)
==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593)
==477545== by 0x4C6DA3D: tracker_data_update_resource (tracker-data-update.c:3626)
==477545== by 0x4CA0498: tracker_direct_batch_update (tracker-direct-batch.c:221)
==477545== by 0x4C9F8B4: update_thread_func (tracker-direct.c:286)
==477545== by 0x492F8A1: g_thread_pool_thread_proxy.lto_priv.0 (gthreadpool.c:352)
==477545== by 0x492A771: g_thread_proxy (gthread.c:831)
==477545== by 0x4D975B4: start_thread (pthread_create.c:442)
==477545== by 0x4E17F03: clone (clone.S:100)
==477545== Address 0xb2ccbe0 is 64 bytes inside a block of size 72 free'd
==477545== at 0x48440E4: free (vg_replace_malloc.c:872)
==477545== by 0x490584C: g_free (gmem.c:229)
==477545== by 0x491FE93: g_slice_free1 (gslice.c:1185)
==477545== by 0x4BFF63B: g_type_free_instance (gtype.c:2010)
==477545== by 0x48EC3C6: UnknownInlinedFun (ghash.c:1774)
==477545== by 0x48EC3C6: g_hash_table_remove (ghash.c:1802)
==477545== by 0x4C71DF5: tracker_db_statement_mru_insert (tracker-db-interface-sqlite.c:2655)
==477545== by 0x4C6AFF8: tracker_data_ensure_update_statement (tracker-data-update.c:1219)
==477545== by 0x4C6AFF8: tracker_data_flush_log (tracker-data-update.c:1242)
==477545== by 0x4C6AFF8: tracker_data_update_buffer_flush (tracker-data-update.c:1550)
==477545== by 0x4C6BA79: tracker_data_update_buffer_might_flush (tracker-data-update.c:1605)
==477545== by 0x4C6BADF: resource_buffer_switch (tracker-data-update.c:2534)
==477545== by 0x4C6BF2C: tracker_data_insert_statement_with_uri (tracker-data-update.c:2857)
==477545== by 0x4C6C497: tracker_data_insert_statement (tracker-data-update.c:2824)
==477545== by 0x4C6D897: update_resource_property (tracker-data-update.c:3489)
==477545== by 0x4C6D4C4: update_resource_single (tracker-data-update.c:3554)
==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442)
==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593)
==477545== by 0x4C6D847: update_resource_property (tracker-data-update.c:3442)
==477545== by 0x4C6D673: update_resource_single (tracker-data-update.c:3593)
==477545== by 0x4C6DA3D: tracker_data_update_resource (tracker-data-update.c:3626)
==477545== by 0x4CA0498: tracker_direct_batch_update (tracker-direct-batch.c:221)
==477545== by 0x4C9F8B4: update_thread_func (tracker-direct.c:286)
==477545== by 0x492F8A1: g_thread_pool_thread_proxy.lto_priv.0 (gthreadpool.c:352)
==477545== by 0x492A771: g_thread_proxy (gthread.c:831)
==477545== by 0x4D975B4: start_thread (pthread_create.c:442)
==477545== by 0x4E17F03: clone (clone.S:100)
==477545== Block was alloc'd at
==477545== at 0x484186F: malloc (vg_replace_malloc.c:381)
==477545== by 0x4909008: g_malloc (gmem.c:130)
==477545== by 0x4920865: g_slice_alloc (gslice.c:1074)
==477545== by 0x4920E9C: g_slice_alloc0 (gslice.c:1100)
==477545== by 0x4C0500B: g_type_create_instance (gtype.c:1913)
==477545== by 0x4BEAC4E: g_object_new_internal (gobject.c:2226)
==477545== by 0x4BEC247: g_object_new_with_properties (gobject.c:2387)
==477545== by 0x4BECFF0: g_object_new (gobject.c:2035)
==477545== by 0x4C71F4F: tracker_db_statement_sqlite_new (tracker-db-interface-sqlite.c:2985)
==477545== by 0x4C71F4F: tracker_db_interface_create_statement (tracker-db-interface-sqlite.c:2751)
==477545== by 0x4C72155: tracker_db_interface_create_vstatement (tracker-db-interface-sqlite.c:2784)
==477545== by 0x4C6B232: tracker_data_ensure_update_statement (tracker-data-update.c:1177)
==477545== by 0x4C6B232: tracker_data_flush_log (tracker-data-update.c:1242)
==477545== by 0x4C6B232: tracker_data_update_buffer_flush (tracker-data-update.c:1550)
==477545== by 0x4C6C6A0: tracker_data_update_statement (tracker-data-update.c:2994)
==477545== by 0x4C60363: tracker_data_ontology_process_statement (tracker-data-manager.c:2346)
==477545== by 0x4C60363: import_ontology_file (tracker-data-manager.c:2389)
==477545== by 0x4C6421D: tracker_data_manager_initable_init (tracker-data-manager.c:4398)
==477545== by 0x4C9E724: tracker_direct_connection_initable_init (tracker-direct.c:493)
==477545== by 0x4A656B7: g_initable_new_valist (ginitable.c:250)
==477545== by 0x4A657AC: g_initable_new (ginitable.c:164)
==477545== by 0x4C9F5AB: tracker_direct_connection_new (tracker-direct.c:1562)
==477545== by 0x4C47D20: tracker_sparql_connection_new (tracker-connection.c:1025)
==477545== by 0x40AF7B: setup_connection_and_endpoint (tracker-main.c:823)
==477545== by 0x40AF7B: main (tracker-main.c:1062)
|
| |
| |
| |
| |
| |
| | |
Unref the task consistently after g_task_run_in_thread(), so it is properly
disposed after the callback finishes execution. This avoids these callbacks
from having to free the task on each return path, which they didn't.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The TrackerTriplesVTab struct created to back the tracker_triples
table up is not being properly freed. Since this is an eponymous-only
table, we never drop the table, thus the xDisconnect vfunc is the
right one for us.
In case we ever wanted to drop the table, make the xDestroy method
the same, since this virtual table creates no supporting non-virtual
tables.
|
| |
| |
| |
| |
| | |
If the binding was already referenced, the lookup string was not
being freed.
|