[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 67/115] libtracker-miner: Fix race which resulted in files being queued out of order
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/shuffle-libtracker-miner: 67/115] libtracker-miner: Fix race which resulted in files being queued out of order
- Date: Thu, 12 Dec 2019 11:12:29 +0000 (UTC)
commit cd1447b43f77e8a32c163253e4e5687fca4e7e76
Author: Sam Thursfield <sam afuera me uk>
Date: Fri Jul 20 16:05:12 2018 +0200
libtracker-miner: Fix race which resulted in files being queued out of order
The TrackerFileNotifier signals need to be emitted in a heirarchical
order. If we have this directory heirarchy...
test-monitored/
test-monitored/file1.txt
...we must always emit ::file-created for 'test-monitored/' before we emit
::file-created for 'test-monitored/file1.txt'.
The tracker_file_notifier_ensure_parents() function ensures that we do
this, but it would previously not work correctly in situations where
'test-monitored/' was a configured indexing root, rather than a
subdirectory of one of the roots.
This was causing the tracker-miners functional tests to randomly fail
with errors such as this:
** (tracker-miner-fs:18181): WARNING **: 16:01:00.461: Parent
'file:///home/sam/tracker-tests/tmpDSmsQI/test-monitored' not indexed yet
This is presumably a regression from 2e2dd4f5dc650aefa4b7188cf1a612b2d27f84ba.
src/libtracker-miner/tracker-file-notifier.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index d90a73325..fdd6e11f3 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1069,8 +1069,7 @@ tracker_file_notifier_ensure_parents (TrackerFileNotifier *notifier,
parent = g_file_get_parent (file);
while (parent) {
- if (tracker_indexing_tree_file_is_root (priv->indexing_tree, parent) ||
- tracker_file_notifier_get_file_iri (notifier, parent, TRUE)) {
+ if (tracker_file_notifier_get_file_iri (notifier, parent, TRUE)) {
g_object_unref (parent);
break;
}
@@ -1082,6 +1081,11 @@ tracker_file_notifier_ensure_parents (TrackerFileNotifier *notifier,
g_object_unref (parent);
g_signal_emit (notifier, signals[FILE_CREATED], 0, canonical);
+
+ if (tracker_indexing_tree_file_is_root (priv->indexing_tree, canonical)) {
+ break;
+ }
+
parent = g_file_get_parent (canonical);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]