Skip to content

Use index to mark parent as outdated, fixes: #14537 - #14571

Merged
MorrisJobke merged 1 commit into
nextcloud:masterfrom
ariselseng:optimize-files_external-notify
Mar 19, 2019
Merged

Use index to mark parent as outdated, fixes: #14537#14571
MorrisJobke merged 1 commit into
nextcloud:masterfrom
ariselseng:optimize-files_external-notify

Conversation

@ariselseng

@ariselsengariselseng commented Mar 6, 2019

Copy link
Copy Markdown
Member

Make inner join to make at least mariadb to use index in update query in Notify.php
Fixes#14537

@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from d471d2d to 0f41197CompareMarch 6, 2019 15:21
@ariselseng
ariselseng requested a review from kesselbMarch 6, 2019 15:24
@ariselsengariselseng added the 2. developing Work in progress label Mar 7, 2019
@ariselseng
ariselseng removed the request for review from kesselbMarch 7, 2019 15:50
@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from 0f41197 to 2ab0bb7CompareMarch 7, 2019 17:18
@ariselsengariselseng added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 7, 2019
@icewind1991

Copy link
Copy Markdown
Member

You're missing the comparison on mount_id.

Also it would be nice to move this over the using the query builder

@ariselseng

Copy link
Copy Markdown
MemberAuthor

Wow that went a little to fast 😄

@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from 2ab0bb7 to ef5ebd6CompareMarch 7, 2019 17:48
@ariselseng

Copy link
Copy Markdown
MemberAuthor

@icewind1991 Doesn't look like querybuilder works with UPDATE and INNER JOIN: https://stackoverflow.com/questions/15293502/doctrine-query-builder-not-working-with-update-and-inner-join

@ariselseng

Copy link
Copy Markdown
MemberAuthor

@icewind1991 Actually, UPDATE with JOINS is not supported in sqlite. Cleanest way would probably be to do it in two queries then. What do you think?

@ariselsengariselseng added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Mar 7, 2019
@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from ef5ebd6 to ab8b977CompareMarch 8, 2019 08:08
@ariselseng

Copy link
Copy Markdown
MemberAuthor

@icewind1991 Alright, now it uses two queries. I moved the reconnect logic to the storageIds query instead. I don't think we need both. I also couldn't figure out how reuse them as prepared statements. Is this okay?

@ariselsengariselseng added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 8, 2019
Comment threadapps/files_external/lib/Command/Notify.php Outdated
@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from ab8b977 to 835d023CompareMarch 8, 2019 11:49
@ariselseng

Copy link
Copy Markdown
MemberAuthor

@kesselb@icewind1991 How does it look now?

One thing in my case where a subfolder is not accessible/listable and hidden on the share for the SMB user. The notify changes are still listed by the SMB server even though the user listening do not have access (I think only NTFS permissions is set). Each time that subfolder is changed, this code will log about missing parent. Probably only a problem for a very few.

Comment threadapps/files_external/lib/Command/Notify.php Outdated
@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from 835d023 to b7e2594CompareMarch 8, 2019 13:13
Comment threadapps/files_external/lib/Command/Notify.php Outdated
@icewind1991

Copy link
Copy Markdown
Member

looks good otherwise

@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch 2 times, most recently from 37bbb34 to c0dc0eeCompareMarch 8, 2019 15:33
@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from c0dc0ee to 4aa30cdCompareMarch 8, 2019 15:34
@ariselsengariselseng mentioned this pull request Mar 12, 2019
@ariselseng

Copy link
Copy Markdown
MemberAuthor

@rullzer@kesselb Any chance of a review? This should make it to 16. Thanks.

Comment threadapps/files_external/lib/Command/Notify.php
Comment threadapps/files_external/lib/Command/Notify.php
Comment threadapps/files_external/lib/Command/Notify.php Outdated
$storageIds = $this->getStorageIds($mountId);
}

if (!$storageIds || count($storageIds) === 0) {

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 would expect that getStorageIds always returns an array $storageIds === [] should work.

$storageIds = $this->getStorageIds($mountId);
} catch (DriverException $ex) {
$this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while trying to mark folder as outdated', 'level' => ILogger::WARN]);
$this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while trying to find correct storage ids.', 'level' => ILogger::WARN]);

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.

The logger should set the right app here. Could you test it without 'app' => 'files_external'?

@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from 4aa30cd to 575de52CompareMarch 15, 2019 16:51
@ariselseng

Copy link
Copy Markdown
MemberAuthor

@kesselb Thank you for you input. I have pushed changes now. Care to have a look again?

Signed-off-by: Ari Selseng <ari@selseng.net>
@ariselseng
ariselsengforce-pushed the optimize-files_external-notify branch from 575de52 to 11b3fbfCompareMarch 18, 2019 17:25
@ariselseng
ariselseng requested a review from kesselbMarch 18, 2019 17:27
@kesselb

Copy link
Copy Markdown
Contributor

Don't have a working test setup for smb 😞 Code looks good 👍

@ariselseng

Copy link
Copy Markdown
MemberAuthor

@MorrisJobke@rullzer is this mergeable?

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good 👍

@MorrisJobke
MorrisJobke merged commit ff6f105 into nextcloud:masterMar 19, 2019
@MorrisJobkeMorrisJobke added this to the Nextcloud 16 milestone Mar 19, 2019
@MorrisJobkeMorrisJobke mentioned this pull request Mar 20, 2019
9 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@ariselseng@icewind1991@kesselb@MorrisJobke