[tracker/journal: 7/21] libtracker-data: STATEMENT_INSERT journal replay performance improvement
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/journal: 7/21] libtracker-data: STATEMENT_INSERT journal replay performance improvement
- Date: Wed, 17 Mar 2010 09:33:09 +0000 (UTC)
commit 6695f9625dd9e6adb820aebf08aa86e67e768899
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Mar 15 10:38:30 2010 +0100
libtracker-data: STATEMENT_INSERT journal replay performance improvement
src/libtracker-data/tracker-data-update.c | 32 +++++++++++++++++++---------
1 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index e311327..33aecfb 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1147,6 +1147,7 @@ static gboolean
cache_set_metadata_decomposed (TrackerProperty *property,
const gchar *value,
const gchar *graph,
+ gint graph_id,
GError **error)
{
gboolean multiple_values, fts;
@@ -1161,7 +1162,7 @@ cache_set_metadata_decomposed (TrackerProperty *property,
/* also insert super property values */
super_properties = tracker_property_get_super_properties (property);
while (*super_properties) {
- cache_set_metadata_decomposed (*super_properties, value, graph, &new_error);
+ cache_set_metadata_decomposed (*super_properties, value, graph, graph_id, &new_error);
if (new_error) {
g_propagate_error (error, new_error);
return FALSE;
@@ -1202,7 +1203,7 @@ cache_set_metadata_decomposed (TrackerProperty *property,
field_name);
} else {
cache_insert_value (table_name, field_name, &gvalue,
- graph != NULL ? ensure_resource_id (graph, NULL) : 0,
+ graph != NULL ? ensure_resource_id (graph, NULL) : graph_id,
multiple_values, fts,
tracker_property_get_data_type (property) == TRACKER_PROPERTY_TYPE_DATETIME);
@@ -1688,7 +1689,7 @@ tracker_data_insert_statement_with_uri (const gchar *graph,
change = TRUE;
} else {
/* add value to metadata database */
- change = cache_set_metadata_decomposed (property, object, graph, &actual_error);
+ change = cache_set_metadata_decomposed (property, object, graph, 0, &actual_error);
if (actual_error) {
tracker_data_update_buffer_clear ();
g_propagate_error (error, actual_error);
@@ -1759,7 +1760,7 @@ tracker_data_insert_statement_with_string (const gchar *graph,
}
/* add value to metadata database */
- change = cache_set_metadata_decomposed (property, object, graph, &actual_error);
+ change = cache_set_metadata_decomposed (property, object, graph, 0, &actual_error);
if (actual_error) {
tracker_data_update_buffer_clear ();
g_propagate_error (error, actual_error);
@@ -2446,17 +2447,28 @@ tracker_data_replay_journal (GHashTable *classes,
} else if (type == TRACKER_DB_JOURNAL_END_TRANSACTION) {
tracker_data_commit_transaction ();
} else if (type == TRACKER_DB_JOURNAL_INSERT_STATEMENT) {
+ TrackerProperty *property;
+
tracker_db_journal_reader_get_statement (&graph_id, &subject_id, &predicate_id, &object);
- if (graph_id > 0) {
- graph = query_resource_by_id (graph_id);
+ property = g_hash_table_lookup (properties, GINT_TO_POINTER (predicate_id));
+
+ if (property) {
+ GError *new_error = NULL;
+
+ resource_buffer_switch (NULL, graph_id, NULL, subject_id);
+
+ cache_set_metadata_decomposed (property, object, 0, NULL, graph_id, &new_error);
+
+ if (new_error) {
+ g_warning ("TODO: handle %s", new_error->message);
+ g_error_free (new_error);
+ }
+
} else {
- graph = NULL;
+ g_warning ("TODO: handle property not in ontology anymore");
}
- subject = query_resource_by_id (subject_id);
- predicate = query_resource_by_id (predicate_id);
- tracker_data_insert_statement_with_string (graph, subject, predicate, object, &error);
} else if (type == TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID) {
tracker_db_journal_reader_get_statement_id (&graph_id, &subject_id, &predicate_id, &object_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]