Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FolderWatcher (linux): optimize slotAddFolderRecursive #5245

Closed
wants to merge 1 commit into from

Conversation

ogoffart
Copy link
Contributor

  • Instead of putting all the pathes in a big QStringList and then process them,
    do the processing as we iterate with QDirIterator
  • Since we know that the parent directory is not ignored, we can simplify the
    ignore check by not checking the part before (i.e: we call
    ExcludedFiles::isExcluded with the parent 'path' as base path) This is what
    speeds up considerably the function.

Note that the OWNCLOUD_TEST check is already there in FolderWatcher::pathIsIgnored
so the behavior is not changed

- Instead of putting all the pathes in a big QStringList and then process them,
  do the processing as we iterate with QDirIterator

- Since we know that the parent directory is not ignored, we can simplify the
  ignore check by not checking the part before (i.e: we call
  ExcludedFiles::isExcluded with the parent 'path' as base path) This is what
  speeds up considerably the function.

Note that the OWNCLOUD_TEST check is already there in FolderWatcher::pathIsIgnored
so the behavior is not changed
@mention-bot
Copy link

@ogoffart, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dragotin, @ckamm and @danimo to be potential reviewers.

@ckamm
Copy link
Contributor

ckamm commented Oct 12, 2016

@ogoffart I haven't read this in detail yet, but wouldn't the change in exclude check break patterns that include the path ("foo/bar/file" wouldn't match if we feed only "file" inside "foo/bar/")? I'm not sure, in general, if we aim to support patterns like that.

@ogoffart
Copy link
Contributor Author

@ckamm good point

@guruz
Copy link
Contributor

guruz commented Oct 14, 2016

I'm actually thinking if we should stop supporting this kind of exclusion pattern?

  1. My Excludes: Use QRegularExpression for speedup WiP #4999 does not support it either (yet)
  2. There is a bug about this that it is broken anyway: sync-exclude.lst not working with full folder patterns #4628

@guruz guruz added this to the 2.3.0 milestone Oct 14, 2016
@ckamm
Copy link
Contributor

ckamm commented Oct 18, 2016

@ogoffart @guruz But wouldn't this change still break full-absolute paths (these, at least, work and users use them), like ignoring "/A/B/C"? Because "/A/B/" is not excluded, and "C" doesn't match any pattern on its own.


_root = QDir::tempPath() + "/" + "test_" + QString::number(qrand());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the test_1231 subdirectory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using QTemporaryDir which take care of that instead of manually creating and destroying the directory.

if (folder.exists() && !watchedFolders.contains(subfolder)) {
#ifndef OWNCLOUD_TEST // InotifyWatcherTest is not interested in ignored files and does not link against the folder
if( _parent->_folder->syncEngine().excludedFiles().isExcluded(
subfolder, path, _parent->_folder->ignoreHiddenFiles())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for correctness this must always pass in the full folder-relative path. (see other comment)

@guruz
Copy link
Contributor

guruz commented Oct 18, 2016

@ckamm I've never seen full absolute paths in the exclude. What is it absolute to? The system root or the sync folder root?

@ckamm
Copy link
Contributor

ckamm commented Oct 18, 2016

@guruz I meant absolute to the sync folder root. For example the "/Music/iTunes/Album Artwork" pattern that @dragotin recommended in #4628.

@ckamm
Copy link
Contributor

ckamm commented Oct 25, 2016

I've created #5275 for discussion about what the desired behavior for exclude patterns even is.

@guruz
Copy link
Contributor

guruz commented Nov 23, 2016

I wrote my personal conclusion as comment on #5275 (comment)
How would we integrate this with this PR here? (Because we want to fix #4628 too)

@guruz guruz modified the milestones: 2.4.0, 2.3.0 Jan 19, 2017
@guruz guruz modified the milestones: 2.4.0, 2.5.0 Oct 4, 2017
@ckamm
Copy link
Contributor

ckamm commented Oct 25, 2017

@ogoffart I'd close this?

@ckamm ckamm closed this Nov 10, 2017
@ogoffart ogoffart deleted the folderwatcher branch January 25, 2018 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants