D21709: [PendingFileQueue] Avoid delete + create / create + delete race

Stefan BrĂ¼ns noreply at phabricator.kde.org
Mon Jun 10 00:05:10 BST 2019


bruns created this revision.
bruns added reviewers: Baloo, ngraham, astippich, poboiko.
Herald added projects: Frameworks, Baloo.
Herald added a subscriber: kde-frameworks-devel.
bruns requested review of this revision.

REVISION SUMMARY
  When the 'delete' flag is set, the file was removed from the index and
  the item was removed from the pending file queue (`m_cache`). When a
  'created' event arrives before the queue has been processed, the flag
  was merged into the queue item, but never processed (delete + create),
  i.e. the file was omitted from the index.
  
  In case a created/modified file was moved to the `m_pendingFiles` queue
  (files to be reindexed later) and deleted, the pending files timer may
  fire before `process` is run, and the `indexNewFile`/`indexModifiedFile`
  signal is emitted for a no longer existing file. Although this is handled
  in the indexer, this causes unnecessary work.
  
  Emit the `removeFileIndex` immediately and remove the file from all
  queues.
  
  A deleted file/folder is kept in the m_recentlyEmitted list, to avoid
  excessive events when e.g. a temporary file is created/deleted in short
  period of time.

TEST PLAN
  `$> date > testfile; rm testfile; date > testfile`
  After the change, testfile is included in the index
  
  `$> date > testfile; date > testfile2; usleep 2000; rm testfile`
  After the change, `indexNewFile` signal is emitted only for testfile2,
  while for testfile `removeFileIndex` is emitted.

REPOSITORY
  R293 Baloo

BRANCH
  fix_races

REVISION DETAIL
  https://phabricator.kde.org/D21709

AFFECTED FILES
  src/file/pendingfile.cpp
  src/file/pendingfilequeue.cpp

To: bruns, #baloo, ngraham, astippich, poboiko
Cc: kde-frameworks-devel, LeGast00n, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190609/4f61ef12/attachment.html>


More information about the Kde-frameworks-devel mailing list