[tracker/wip/carlosg/backports-3.3: 2/4] libtracker-sparql: Remove value from array after deletion
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/backports-3.3: 2/4] libtracker-sparql: Remove value from array after deletion
- Date: Mon, 30 May 2022 13:42:55 +0000 (UTC)
commit 8cd88bb63679d9d204cc4ed5fd9f8b5f104ec867
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed May 4 21:44:55 2022 +0200
libtracker-sparql: Remove value from array after deletion
Every other path that fetches the array of previous values for
deletion also deletes the GValue from the cached array. This
place handling our almost unused, non-standard INSERT OR REPLACE
syntax, was missing this.
Since the handling of FTS updates later poke the cached values
to update all FTS columns, this may result in the deleted value
being inserted again in the FTS tree, resulting in another
unbalanced tree situation (as the actual column containing the
data and the token tree for the corresponding content-less column
in the FTS table differ).
An example of this situation is:
INSERT OR REPLACE {
<a> a nie:InformationElement;
nie:title 'title';
}
INSERT OR REPLACE {
<a> a nie:InformationElement;
nie:title 'title2';
}
SELECT ?u { ?u fts:match 'title' }
Returning matches for the old value.
(cherry-picked from commit 6067f032d3b7ed4614bedf840b4edc86165567e3)
src/libtracker-data/tracker-data-update.c | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 703de96c9..2b5935a1a 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2443,6 +2443,8 @@ delete_single_valued (TrackerData *data,
FALSE);
if (tracker_property_get_data_type (predicate) == TRACKER_PROPERTY_TYPE_RESOURCE)
tracker_data_resource_unref (data, g_value_get_int64 (value),
multiple_values);
+
+ g_array_remove_index (old_values, 0);
} else {
/* no need to error out if statement does not exist for any reason */
g_clear_error (&inner_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]