[tracker/wip/carlosg/fix-nrl-modified] libtracker-data: Fetch nrl:modified from all graphs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/fix-nrl-modified] libtracker-data: Fetch nrl:modified from all graphs
- Date: Tue, 5 Jul 2022 10:09:39 +0000 (UTC)
commit 80fe41654e0bd2349359a8724bda3781e1a87f6d
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jul 5 11:30:16 2022 +0200
libtracker-data: Fetch nrl:modified from all graphs
We are just looking at the default graph when initializing nrl:modified
after opening an existing database. Since the default graph possibly
only contains part of the data, are possibly/likely missing the latest
sequence number if used on other graphs.
Check all graphs here relying on our virtual tracker_triples table, so
we are ensured to get the actual latest/greatest nrl:modified sequence
that was previously used from the union of all graphs. This ensures us
to get always a fresh sequence number for newly inserted data.
src/libtracker-sparql/core/tracker-data-update.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index a4ebaaa04..10abd777d 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -408,6 +408,8 @@ tracker_data_update_initialize_modseq (TrackerData *data,
TrackerDBCursor *cursor = NULL;
TrackerDBInterface *temp_iface;
TrackerDBStatement *stmt;
+ TrackerOntologies *ontologies;
+ TrackerProperty *property;
GError *inner_error = NULL;
gint max_modseq = 0;
@@ -416,9 +418,13 @@ tracker_data_update_initialize_modseq (TrackerData *data,
return TRUE;
temp_iface = tracker_data_manager_get_writable_db_interface (data->manager);
+ ontologies = tracker_data_manager_get_ontologies (data->manager);
+ property = tracker_ontologies_get_property_by_uri (ontologies, TRACKER_PREFIX_NRL "modified");
- stmt = tracker_db_interface_create_statement (temp_iface, TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT,
&inner_error,
- "SELECT MAX(\"nrl:modified\") AS A FROM
\"rdfs:Resource\"");
+ stmt = tracker_db_interface_create_vstatement (temp_iface, TRACKER_DB_STATEMENT_CACHE_TYPE_SELECT,
&inner_error,
+ "SELECT MAX(object) FROM tracker_triples "
+ "WHERE predicate = %" G_GINT64_FORMAT,
+ tracker_property_get_id (property));
if (stmt) {
cursor = tracker_db_statement_start_cursor (stmt, &inner_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]