[tracker/wip/carlosg/test-error-fixes: 5/5] libtracker-data: Ensure to synchronize cached values after delete




commit 246d4190d1c6ab4aa01c416be7106d09bf0dd826
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 13 12:25:08 2021 +0200

    libtracker-data: Ensure to synchronize cached values after delete
    
    In these paths of TrackerResource insertion handling for single valued
    properties, we schedule property deletion, but don't synchronize the
    cache here. Clear the value array contents so future checks match.
    
    This is the most direct cause of the warning seen at
    https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/179, there
    is a double CREATED event emission going on there, that due to
    non-atomicity in the file creation operation has those TrackerResources
    disagreeing in the nfo:fileSize for the file.
    
    Being those 2 tracker_resource_set_*() operations, we schedule prior
    deletes, but at the time of handling the second nfo:fileSize we'd
    still be thinking there was a value left in the array, due to the lack
    of sync.
    
    Fixes: https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/179

 src/libtracker-data/tracker-data-update.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 2103271b0..437859af3 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2519,6 +2519,11 @@ delete_all_helper (TrackerData      *data,
                super_properties++;
        }
 
+       if (subproperty == property) {
+               /* Clear the buffered property values */
+               g_array_remove_range (old_values, 0, old_values->len);
+       }
+
        return TRUE;
 }
 


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