Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
  2. index 5b6ece1..cb3a0a1 100644
  3. --- a/src/libtracker-data/tracker-data-update.c
  4. +++ b/src/libtracker-data/tracker-data-update.c
  5. @@ -151,6 +151,8 @@ static TrackerDataUpdateBuffer update_buffer;
  6. static TrackerDataUpdateBufferResource *resource_buffer;
  7. static TrackerDataBlankBuffer blank_buffer;
  8. static time_t resource_time = 0;
  9. +static gint transaction_modseq = 0;
  10. +static gboolean has_persistent = TRUE;
  11.  
  12. static GPtrArray *insert_callbacks = NULL;
  13. static GPtrArray *delete_callbacks = NULL;
  14. @@ -158,7 +160,7 @@ static GPtrArray *commit_callbacks = NULL;
  15. static GPtrArray *rollback_callbacks = NULL;
  16. static gint max_service_id = 0;
  17. static gint max_ontology_id = 0;
  18. -static gint max_modseq = 0;
  19. +static gint max_modseq = 1;
  20.  
  21. static gint ensure_resource_id (const gchar *uri,
  22. gboolean *create);
  23. @@ -418,7 +420,7 @@ tracker_data_update_shutdown (void)
  24. {
  25. max_service_id = 0;
  26. max_ontology_id = 0;
  27. - max_modseq = 0;
  28. + max_modseq = 1;
  29. }
  30.  
  31. static gint
  32. @@ -429,7 +431,7 @@ tracker_data_update_get_next_modseq (void)
  33. TrackerDBStatement *stmt;
  34. GError *error = NULL;
  35.  
  36. - if (G_LIKELY (max_modseq != 0)) {
  37. + if (G_LIKELY (max_modseq != 1)) {
  38. return ++max_modseq;
  39. }
  40.  
  41. @@ -502,7 +504,7 @@ cache_ensure_table (const gchar *table_name,
  42. resource_buffer->modified = TRUE;
  43.  
  44. g_value_init (&gvalue, G_TYPE_INT64);
  45. - g_value_set_int64 (&gvalue, tracker_data_update_get_next_modseq ());
  46. + g_value_set_int64 (&gvalue, transaction_modseq);
  47. cache_insert_value ("rdfs:Resource", "tracker:modified", TRUE, &gvalue,
  48. 0,
  49. FALSE, FALSE, FALSE);
  50. @@ -552,6 +554,10 @@ cache_insert_value (const gchar *table_name,
  51. #endif
  52. property.date_time = date_time;
  53.  
  54. + if (!transient) {
  55. + has_persistent = TRUE;
  56. + }
  57. +
  58. table = cache_ensure_table (table_name, multiple_values, transient);
  59. g_array_append_val (table->properties, property);
  60. }
  61. @@ -586,6 +592,10 @@ cache_delete_value (const gchar *table_name,
  62. #endif
  63. property.date_time = date_time;
  64.  
  65. + if (!transient) {
  66. + has_persistent = TRUE;
  67. + }
  68. +
  69. table = cache_ensure_table (table_name, multiple_values, transient);
  70. table->delete_value = TRUE;
  71. g_array_append_val (table->properties, property);
  72. @@ -2394,6 +2404,8 @@ tracker_data_begin_transaction (GError **error)
  73.  
  74. resource_time = time (NULL);
  75.  
  76. + has_persistent = FALSE;
  77. +
  78. if (update_buffer.resource_cache == NULL) {
  79. update_buffer.resource_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
  80. /* used for normal transactions */
  81. @@ -2458,6 +2470,7 @@ tracker_data_commit_transaction (GError **error)
  82. }
  83.  
  84. in_transaction = FALSE;
  85. + transaction_modseq = tracker_data_update_get_next_modseq ();
  86. in_ontology_transaction = FALSE;
  87.  
  88. if (!in_journal_replay) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement