Skip to content

Add index to properties table - #20716

Merged
rullzer merged 1 commit into
masterfrom
index-propertypath
May 1, 2020
Merged

Add index to properties table#20716
rullzer merged 1 commit into
masterfrom
index-propertypath

Conversation

@mario

Copy link
Copy Markdown
Contributor

Signed-off-by: Mario Danic mario@lovelyhq.com

@mario
mario marked this pull request as draft April 29, 2020 12:12
@mario
marioforce-pushed the index-propertypath branch from 8cca823 to 4946e7cCompareApril 29, 2020 13:13
@mario
mario marked this pull request as ready for review April 29, 2020 13:27
@mariomario added the 3. to review Waiting for reviews label Apr 29, 2020
@mario

Copy link
Copy Markdown
ContributorAuthor

Would be awesome to get this in 19.

@mariomario added this to the Nextcloud 19 milestone Apr 29, 2020
@rullzerrullzer mentioned this pull request Apr 29, 2020
11 tasks
@mario

Copy link
Copy Markdown
ContributorAuthor

This speeds up access to folders with lots of files considerably.

@mario

Copy link
Copy Markdown
ContributorAuthor

I'm pretty sure the odd test failure is not related to me adding indexes.

@icewind1991

Copy link
Copy Markdown
Member

The autoloaders are not up to date
Please run: bash build/autoloaderchecker.sh
And commit the result

is yours

@mario
marioforce-pushed the index-propertypath branch from 4946e7c to 2db36adCompareApril 29, 2020 20:15
@mario

Copy link
Copy Markdown
ContributorAuthor

The autoloaders are not up to date
Please run: bash build/autoloaderchecker.sh
And commit the result

is yours

Thanks.

gary-kim
gary-kim previously requested changes Apr 29, 2020

@gary-kimgary-kim 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.

I think you may have accidentally committed composer.phar?

@mario
marioforce-pushed the index-propertypath branch from 2db36ad to 9e2aecbCompareApril 29, 2020 22:13
@mario

Copy link
Copy Markdown
ContributorAuthor

I think you may have accidentally committed composer.phar?

Good catch, fixed.

MorrisJobke
MorrisJobke previously requested changes Apr 30, 2020

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

Please add to the check for the missing indices so that admins are notified about this:

$eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT,

@mario

Copy link
Copy Markdown
ContributorAuthor

Please add to the check for the missing indices so that admins are notified about this:

$eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT,

Fix pushed.

@mario
marioforce-pushed the index-propertypath branch from bad5a14 to 4243d5dCompareApril 30, 2020 12:36
@mario

Copy link
Copy Markdown
ContributorAuthor

So lint is complaining about lib/private/Files/ObjectStore/Swift.php which I didn't touch and I can't run composer run cs:fix because it errors out with:

Fatal error: Uncaught Error: Class 'Nextcloud\CodingStandard\Config' not found in /Users/mario/Projects/server/.php_cs.dist:9

@MorrisJobke

Copy link
Copy Markdown
Member

So lint is complaining about lib/private/Files/ObjectStore/Swift.php which I didn't touch and I can't run composer run cs:fix because it errors out with:

It is already fixed in #20742

@mario
marioforce-pushed the index-propertypath branch from 4243d5d to b94240cCompareApril 30, 2020 13:03
Comment threadcore/Application.php Outdated
Comment threadcore/Command/Db/AddMissingIndices.php Outdated
Comment threadcore/Migrations/Version19000Date20200429140134.php Outdated
@mario
marioforce-pushed the index-propertypath branch from d8cc68d to f282975CompareApril 30, 2020 13:06
@mario

Copy link
Copy Markdown
ContributorAuthor

@MorrisJobke thanks, fixed. Thanks to you and @icewind1991 for mentoring, and @gary-kim and @ChristophWurst of course! :)

@mario
mario requested a review from MorrisJobkeApril 30, 2020 13:18
@rullzerrullzer mentioned this pull request Apr 30, 2020
2 tasks
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version19000Date20200429140134 extends SimpleMigrationStep {

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.

I just noticed that you want to do this in a migration. Then the step in the "add-missing-indices" is not needed. I guess we should not do the migration here (because it can take really long and thus break the update). Better is to put the addIndex() to an old migration, so that it is executed on new installs. And for existing installations we do the approach with the admin notification and the add-missing-indices command to add the index while the instance is online.

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.

@mario I just noticed that I had this as pending open. That's why I said that in the chat back then ;)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

What migration do you want me to put it in @MorrisJobke ?

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.

Right below that line I would say:

$table->setPrimaryKey(['userid', 'appid', 'configkey']);
(it's the only migration for preferences in core)

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.

Just for reference - that's how we did it for other indices as well: https://github.com/nextcloud/server/pull/13213/files

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

You just confused the hell out of me - I hope you meant few lines further where the migration for properties is, and not preferences? :D

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This is for preferences, I need it for properties :P But found it, thanks!

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.

Ah yes - sorry. Far better now 👍

Signed-off-by: Mario Danic <mario@lovelyhq.com>
@mario

Copy link
Copy Markdown
ContributorAuthor

Let's hope its good now :p

@mario
marioforce-pushed the index-propertypath branch from f282975 to 6e28c28CompareApril 30, 2020 21:05
@mariomario changed the title Add index to oc_propertiesAdd index to properties tableApr 30, 2020
@rullzer
rullzer merged commit 80372a3 into masterMay 1, 2020
@rullzer
rullzer deleted the index-propertypath branch May 1, 2020 10:39
@dennisTGC

Copy link
Copy Markdown

Will this be back-ported to a minor v18 release?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@mario@icewind1991@MorrisJobke@dennisTGC@ChristophWurst@gary-kim@rullzer