Skip to content

Add getTagsForObjects in ITags - #12409

Merged
nickvergessen merged 1 commit into
masterfrom
tags-getTagsForObjectIds
Dec 9, 2014
Merged

nickvergessen merged 1 commit into
masterfrom
tags-getTagsForObjectIds

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

Returns the list of tags that are set on the given object ids.

Required for the "favorites/tags" task (#2368) but also a nice addition to the API.
See https://github.com/owncloud/core/pull/12360/files#diff-471be045dd1eb605d9a1197b9ba90560R52

Please review @ockham @LukasReschke @icewind1991 @DeepDiver1975

@PVince81

Copy link
Copy Markdown
Contributor Author

I'm not sure whether this API call should pre-group the tags by object id as it might have some performance impact.

@PVince81 PVince81 added this to the 8.0-current milestone Nov 25, 2014
@PVince81

Copy link
Copy Markdown
Contributor Author

Set milestone to OC 8 as it's a requirement to be able to implement files favorites.

@ghost

ghost commented Nov 25, 2014

Copy link
Copy Markdown

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3201/
🚀 Test PASSed. 🚀

Comment thread lib/private/tags.php Outdated

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.

Is this even worth the trouble? the query will not be faster, but the code is way more complex with this exception.

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.

If called multiple times in a row, having a prepared statement will make subsequent calls faster. (the prepared statements are cached somewhere inside our DB wrappers)

But as you say, not sure if it's worth the hassle.

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.

@icewind1991 can you give a second opinion on this ?

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.

not worth it, executequery() internally creates a prepared statement because that implements the logic to replace questionmarks with the correctly escaped value.

if you really want to make this faster you should reduce the number of trips to the db. have a look at the search query in the filecache that does chunks of 1000 with sql IN () to not break mysql.

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.

Ok thanks for the clarification, I'll make this a single block.

@PVince81

PVince81 commented Dec 1, 2014

Copy link
Copy Markdown
Contributor Author

I just changed the output response, now it look like this: 7f65341#diff-dfb81a403f62a6e3eb4355d23574c370R83

@ghost

ghost commented Dec 1, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3527/

Build result: FAILURE

[...truncated 14 lines...] > git config remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10 > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git2310964744155017692.credentials # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse origin/pr/12409/merge^{commit} # timeout=10Checking out Revision 340b8a71a884d7062eb0363688007bf2297f6651 (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 340b8a71a884d7062eb0363688007bf2297f6651 > git rev-list e72fb50fbd935e0411f05e344ca50693d3945918 # timeout=10 > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 20 second
💣 Test FAILed. 💣

@PVince81

PVince81 commented Dec 1, 2014

Copy link
Copy Markdown
Contributor Author
  • need to sort the tags before assert

@ghost

ghost commented Dec 2, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3575/

Build result: FAILURE

[...truncated 15 lines...] > git config remote.origin.url https://github.com/owncloud/core.git # timeout=10Fetching upstream changes from https://github.com/owncloud/core.gitusing GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git622049702073431526.credentials # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse origin/pr/12409/merge^{commit} # timeout=10Checking out Revision 1c52a033124a822434a9cc52dc9291bcc24afd44 (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 1c52a033124a822434a9cc52dc9291bcc24afd44 > git rev-list 7aabfa3e7fffd1486c0c1a27e935605b57d98062 # timeout=10 > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02Configuration pull-request-analyser-ng-simple » vm-slave-02 is still in the queue: Waiting for next available executor on vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 12 second
💣 Test FAILed. 💣

@ghost

ghost commented Dec 4, 2014

Copy link
Copy Markdown

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3787/
🚀 Test PASSed. 🚀

@PVince81

PVince81 commented Dec 8, 2014

Copy link
Copy Markdown
Contributor Author

I fixed the query

@icewind1991

Copy link
Copy Markdown
Contributor

Code looks good 👍

Comment thread lib/private/tags.php Outdated

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.

Invalid PHP Doc. @return array $entries

@PVince81
PVince81 force-pushed the tags-getTagsForObjectIds branch from d93d470 to 8c7188a Compare December 8, 2014 15:25
@PVince81

PVince81 commented Dec 8, 2014

Copy link
Copy Markdown
Contributor Author

Fixed and squashed

@ghost

ghost commented Dec 8, 2014

Copy link
Copy Markdown

💣 Test FAILed. 💣
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/4009/

Build result: FAILURE

[...truncated 18 lines...]using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git4318160896435315280.credentials # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse origin/pr/12409/merge^{commit} # timeout=10 > git branch -a --contains 1eaf2ffd5d1c33fde46f50fa462d5327c2d092d9 # timeout=10 > git rev-parse remotes/origin/pr/12409/merge^{commit} # timeout=10Checking out Revision 1eaf2ffd5d1c33fde46f50fa462d5327c2d092d9 (origin/pr/12409/merge) > git config core.sparsecheckout # timeout=10 > git checkout -f 1eaf2ffd5d1c33fde46f50fa462d5327c2d092d9First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » vm-slave-02Configuration pull-request-analyser-ng-simple » vm-slave-02 is still in the queue: Waiting for next available executor on vm-slave-02pull-request-analyser-ng-simple » vm-slave-02 completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 5 minutesDisk usage plugin fails during calculation disk usage of this build.
💣 Test FAILed. 💣

Comment thread lib/private/tags.php Outdated

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.

Do we need keep the mysql limit for the number of values in an IN into account or does dbal handle it?

@icewind1991

Copy link
Copy Markdown
Contributor

👍 otherwise

@ghost

ghost commented Dec 8, 2014

Copy link
Copy Markdown

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/4034/
🚀 Test PASSed. 🚀

Comment thread lib/private/tags.php Outdated

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.

hm ... The limit I ran into is 1000: 592a2dc#diff-fe310df5db90426b42447108ef4d3483L331

The code has since been removed by recursively descending the tree ...

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.

Yeah... I found other pieces of code, some with 200, 90 or 20... I picked the biggest number.
Should I increase to 1000 then ?

Returns the list of tags that are set on the given object ids.
@PVince81
PVince81 force-pushed the tags-getTagsForObjectIds branch from b9fa1b4 to cae6007 Compare December 8, 2014 21:02
@PVince81

PVince81 commented Dec 8, 2014

Copy link
Copy Markdown
Contributor Author

Changed chunking limit to 1000

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 9 new issues, 3 updated code elements

@ghost

ghost commented Dec 8, 2014

Copy link
Copy Markdown

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/4047/
🚀 Test PASSed. 🚀

@PVince81

PVince81 commented Dec 9, 2014

Copy link
Copy Markdown
Contributor Author

@nickvergessen @butonic @LukasReschke can this be merged ?

Comment thread lib/private/tags.php

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 we should add a method for that to our DB object instead of having this duplicated in the code again and again...
But okay for now

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.

Will be done here: #12219
I'll add a comment to make sure the chunking part is added there as well.

@PVince81

PVince81 commented Dec 9, 2014

Copy link
Copy Markdown
Contributor Author

@nickvergessen Do your comments containing the keyword "okay" count as a thumbs up ?

@nickvergessen

Copy link
Copy Markdown
Contributor

👍

nickvergessen added a commit that referenced this pull request Dec 9, 2014
@nickvergessen
nickvergessen merged commit f53f25e into master Dec 9, 2014
@nickvergessen
nickvergessen deleted the tags-getTagsForObjectIds branch December 9, 2014 12:27
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants