[tracker/tracker-0.10] tracker-monitor: translate CREATE(a)+MOVE(a->b)=UPDATE(b)
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] tracker-monitor: translate CREATE(a)+MOVE(a->b)=UPDATE(b)
- Date: Thu, 16 Jun 2011 16:11:04 +0000 (UTC)
commit 18a10ae3ebaac1efed899b663ef13e2748556ed0
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Jun 16 11:53:07 2011 +0200
tracker-monitor: translate CREATE(a)+MOVE(a->b)=UPDATE(b)
Fixes NB#251032. Tracker-writeback often creates a temporary hidden
file that, after modification, is moved onto the original file location,
This tricked TrackerMonitor so that the create and move operations there
were translated as a create operation, and create operations are
compressed with delete events into a noop. So if a quick delete came
after, TrackerMonitor was emitting no signal for a truly deleted file.
Instead, translate create+move as update, the miners handle creates
and updates equally, and these won't get compressed with delete
events, so those are still emitted.
src/libtracker-miner/tracker-monitor.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 89e0b45..5e3c3fd 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -995,18 +995,30 @@ monitor_event_file_moved (TrackerMonitor *monitor,
* */
if (previous_update_event_data) {
if (previous_update_event_data->event_type == G_FILE_MONITOR_EVENT_CREATED) {
- /* (a) CREATED(A) + MOVED(A->B) = CREATED (B)
+ /* (a) CREATED(A) + MOVED(A->B) = UPDATED (B)
*
* Oh, oh, oh, we got a previous created event
* waiting in the event cache... so we remove it, and we
- * convert the MOVE event into a CREATED(other_file) */
+ * convert the MOVE event into a UPDATED(other_file),
+ *
+ * It is UPDATED instead of CREATED because the destination
+ * file could probably exist, and mistakenly reporting
+ * a CREATED event there can trick the monitor event
+ * compression (for example, if we get a DELETED right after,
+ * both CREATED/DELETED events turn into NOOP, so a no
+ * longer existing file didn't trigger a DELETED.
+ *
+ * Instead, it is safer to just issue UPDATED, this event
+ * wouldn't get compressed, and CREATED==UPDATED to the
+ * miners' eyes.
+ */
g_hash_table_remove (monitor->priv->pre_update, src_file);
g_hash_table_replace (monitor->priv->pre_update,
g_object_ref (dst_file),
event_data_new (dst_file,
NULL,
FALSE,
- G_FILE_MONITOR_EVENT_CREATED));
+ G_FILE_MONITOR_EVENT_CHANGED));
/* Do not notify the moved event now */
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]