[tracker] tracker-store, libtracker-data: Workaround for graph not being used in SPARQL DELETE



commit b3546686d904993b9a9ecaefbf056517e8532bd1
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Aug 26 16:52:25 2010 +0200

    tracker-store, libtracker-data: Workaround for graph not being used in SPARQL DELETE
    
    Because GRAPH is kept NULL for tracker-data-update.c during a SPARQL DELETE with a
    graph wasn't the writeback functionality being done correctly: only for the
    default graph must the writeback signal emit. But with graph always being NULL for
    deletes, would it always emit for any delete.
    
    And the IgnoreNextUpdate SPARQL query of tracker-miner-fs does a DELETE in a graph,
    meaning that this triggers tracker-store into doing a new writeback emit, and makes
    tracker-writeback writeback again, and that makes miner-fs do a new IgnoreNextUpdate,
    until the end of times (endless loop between store, writeback and miner-fs)

 src/libtracker-data/tracker-data-update.c |   10 +++++-----
 src/libtracker-data/tracker-data-update.h |    1 +
 src/tracker-store/tracker-resources.c     |    8 +++++---
 src/tracker-store/tracker-writeback.c     |    3 ++-
 src/tracker-store/tracker-writeback.h     |    1 +
 5 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 9b60d62..19415c0 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1078,7 +1078,7 @@ cache_create_service_decomposed (TrackerClass *cl,
 			TrackerStatementDelegate *delegate;
 
 			delegate = g_ptr_array_index (insert_callbacks, n);
-			delegate->callback (final_graph_id, resource_buffer->id, resource_buffer->subject,
+			delegate->callback (final_graph_id, graph, resource_buffer->id, resource_buffer->subject,
 			                    tracker_property_get_id (tracker_ontologies_get_rdf_type ()),
 			                    class_id,
 			                    tracker_class_get_uri (cl),
@@ -1691,7 +1691,7 @@ cache_delete_resource_type (TrackerClass *class,
 			TrackerStatementDelegate *delegate;
 
 			delegate = g_ptr_array_index (delete_callbacks, n);
-			delegate->callback (final_graph_id, resource_buffer->id, resource_buffer->subject,
+			delegate->callback (final_graph_id, graph, resource_buffer->id, resource_buffer->subject,
 			                    tracker_property_get_id (tracker_ontologies_get_rdf_type ()),
 			                    tracker_class_get_id (class),
 			                    tracker_class_get_uri (class),
@@ -1865,7 +1865,7 @@ tracker_data_delete_statement (const gchar  *graph,
 				TrackerStatementDelegate *delegate;
 
 				delegate = g_ptr_array_index (delete_callbacks, n);
-				delegate->callback (graph_id, subject_id, subject,
+				delegate->callback (graph_id, graph, subject_id, subject,
 				                    pred_id, object_id,
 				                    object,
 				                    resource_buffer->types,
@@ -2068,7 +2068,7 @@ tracker_data_insert_statement_with_uri (const gchar            *graph,
 					TrackerStatementDelegate *delegate;
 
 					delegate = g_ptr_array_index (insert_callbacks, n);
-					delegate->callback (graph_id, resource_buffer->id, subject,
+					delegate->callback (graph_id, graph, resource_buffer->id, subject,
 					                    final_prop_id, object_id,
 					                    object,
 					                    resource_buffer->types,
@@ -2147,7 +2147,7 @@ tracker_data_insert_statement_with_string (const gchar            *graph,
 			TrackerStatementDelegate *delegate;
 
 			delegate = g_ptr_array_index (insert_callbacks, n);
-			delegate->callback (graph_id, resource_buffer->id, subject,
+			delegate->callback (graph_id, graph, resource_buffer->id, subject,
 			                    pred_id, 0 /* Always a literal */,
 			                    object,
 			                    resource_buffer->types,
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 085155c..aaed202 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -35,6 +35,7 @@ G_BEGIN_DECLS
 #endif
 
 typedef void (*TrackerStatementCallback) (gint         graph_id,
+                                          const gchar *graph,
                                           gint         subject_id,
                                           const gchar *subject,
                                           gint         predicate_id,
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index 4ba91ee..30f443c 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -698,6 +698,7 @@ check_class_signal_signal (TrackerResources *object)
 
 static void
 on_statement_inserted (gint         graph_id,
+                       const gchar *graph,
                        gint         subject_id,
                        const gchar *subject,
                        gint         pred_id,
@@ -709,11 +710,12 @@ on_statement_inserted (gint         graph_id,
 	tracker_events_add_insert (graph_id, subject_id, subject, pred_id,
 	                           object_id, object, rdf_types);
 	check_class_signal_signal (user_data);
-	tracker_writeback_check (graph_id, subject_id, subject, pred_id, object_id, object, rdf_types);
+	tracker_writeback_check (graph_id, graph, subject_id, subject, pred_id, object_id, object, rdf_types);
 }
 
 static void
 on_statement_deleted (gint         graph_id,
+                      const gchar *graph,
                       gint         subject_id,
                       const gchar *subject,
                       gint         pred_id,
@@ -725,8 +727,8 @@ on_statement_deleted (gint         graph_id,
 	tracker_events_add_delete (graph_id, subject_id, subject, pred_id,
 	                           object_id, object, rdf_types);
 	check_class_signal_signal (user_data);
-	tracker_writeback_check (graph_id, subject_id, subject, pred_id,
-	                         object_id, object, rdf_types);
+//	tracker_writeback_check (graph_id, graph, subject_id, subject, pred_id,
+//	                         object_id, object, rdf_types);
 }
 
 void
diff --git a/src/tracker-store/tracker-writeback.c b/src/tracker-store/tracker-writeback.c
index 0e54226..73c785a 100644
--- a/src/tracker-store/tracker-writeback.c
+++ b/src/tracker-store/tracker-writeback.c
@@ -57,6 +57,7 @@ array_free (GArray *array)
 
 void
 tracker_writeback_check (gint         graph_id,
+                         const gchar *graph,
                          gint         subject_id,
                          const gchar *subject,
                          gint         pred_id,
@@ -69,7 +70,7 @@ tracker_writeback_check (gint         graph_id,
 	 * aren't coming from the miner)
 	 */
 
-	if (graph_id != 0) {
+	if (graph != NULL) {
 		/* g_debug ("Not doing writeback check, no graph"); */
 		return;
 	}
diff --git a/src/tracker-store/tracker-writeback.h b/src/tracker-store/tracker-writeback.h
index fb0df6c..907c601 100644
--- a/src/tracker-store/tracker-writeback.h
+++ b/src/tracker-store/tracker-writeback.h
@@ -32,6 +32,7 @@ typedef GStrv (*TrackerWritebackGetPredicatesFunc) (void);
 void        tracker_writeback_init        (TrackerWritebackGetPredicatesFunc callback);
 void        tracker_writeback_shutdown    (void);
 void        tracker_writeback_check       (gint         graph_id,
+                                           const gchar *graph,
                                            gint         subject_id,
                                            const gchar *subject,
                                            gint         pred_id,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]