Skip to content

FolderWatcher (linux): optimize slotAddFolderRecursive - #5245

Closed
ogoffart wants to merge 1 commit into
masterfrom
folderwatcher
Closed

ogoffart wants to merge 1 commit into
masterfrom
folderwatcher

Conversation

@ogoffart

Copy link
Copy Markdown
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
Copy Markdown

@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

ckamm commented Oct 12, 2016

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

@ckamm good point

@guruz

guruz commented Oct 14, 2016

Copy link
Copy Markdown
Contributor

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

ckamm commented Oct 18, 2016 •

Copy link
Copy Markdown
Contributor

@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.

void testAddFolderRecursiveHelper() {
QTemporaryDir tmpDir;

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

guruz commented Oct 18, 2016

Copy link
Copy Markdown
Contributor

@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

ckamm commented Oct 18, 2016

Copy link
Copy Markdown
Contributor

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

@ckamm

ckamm commented Oct 25, 2016

Copy link
Copy Markdown
Contributor

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

@guruz

guruz commented Nov 23, 2016

Copy link
Copy Markdown
Contributor

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

ckamm commented Oct 25, 2017

Copy link
Copy Markdown
Contributor

@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