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

backport search in shared files to stable5 #5487

Merged
merged 4 commits into from
Oct 30, 2013

Conversation

butonic
Copy link
Member

@butonic butonic commented Oct 23, 2013

backport of #4207

@butonic
Copy link
Member Author

butonic commented Oct 23, 2013

@DeepDiver1975 @karlitschek @schiesbn @icewind1991 please review.

@karlitschek
Copy link
Contributor

👍

@ghost
Copy link

ghost commented Oct 23, 2013

Test passed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1733/

@butonic
Copy link
Member Author

butonic commented Oct 23, 2013

Found a bug that blocks merging. I'll ping you all again when this can be reviewed further.

@butonic
Copy link
Member Author

butonic commented Oct 23, 2013

@DeepDiver1975 @schiesbn @icewind1991 fixed problem, please review by sharing a folder or file to anohter user and try searching in shared files. If you want to be thorough search for something that will give more than 1000 results.

@ghost
Copy link

ghost commented Oct 23, 2013

Test passed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1738/

@DeepDiver1975
Copy link
Member

need to create a few test files ❓

for i in {1..2000}; do dd if=/dev/urandom bs=1 count=1 of=file$i; done

@DeepDiver1975
Copy link
Member

🔙

[Thu Oct 24 00:26:30 2013] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'DatabaseException' with message 'SQLSTATE[HY000]: General error: 1 too many SQL variables' in /home/thomas/Development/owncloud/stable5/lib/db.php:391\nStack trace:\n
#0 /home/thomas/Development/owncloud/stable5/apps/files_sharing/lib/cache.php(240): OC_DB::prepare('SELECT `fileid`...')\n
#1 /home/thomas/Development/owncloud/stable5/lib/files/view.php(1004): OC\\Files\\Cache\\Shared_Cache->search('%fil%')\n
#2 /home/thomas/Development/owncloud/stable5/lib/files/view.php(962): OC\\Files\\View->searchCommon('%fil%', 'search')\n
#3 /home/thomas/Development/owncloud/stable5/lib/files/filesystem.php(558): OC\\Files\\View->search('fil')\n
#4 /home/thomas/Development/owncloud/stable5/lib/search/provider/file.php(5): OC\\Files\\Filesystem::search('fil', true)\n
#5 /home/thomas/Development/owncloud/stable5/lib/search.php(56): OC_Search_Provider_File->search('fil')\n
#6 /home/thomas/Development/owncloud/stable5/search/ajax/search.php(30): OC_Search::search('fil')\n
#7 /home/thomas/Development/owncloud/stable5/lib/route.php(1 in /home/thomas/Development/owncloud/stable5/lib/db.php on line 391, referer: http://localhost/owncloud/stable5/index.php/apps/files

@DeepDiver1975
Copy link
Member

reducing the chunk count to 998 finally solved the issue on my installation

$result = $query->execute(array_merge(array($mimetype), $ids));
return $result->fetchAll();

$files = array();
Copy link

Choose a reason for hiding this comment

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

This block is a 98% copy of the block above.

@butonic
Copy link
Member Author

butonic commented Oct 29, 2013

@bantu @DeepDiver1975 please review the cleanup

* @param string $wherevalue
* @return array
*/
private function searchWithWhere ($sqlwhere, $wherevalue, $chunksize = self::MAX_SQL_CHUNK_SIZE) {
Copy link

Choose a reason for hiding this comment

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

No space. searchWithWhere ($sqlwhere

@ghost
Copy link

ghost commented Oct 29, 2013

Test failed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1824/

@ghost
Copy link

ghost commented Oct 29, 2013

Test passed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1825/

- extract method,
- introduce MAX CHUNK SIZE const with 999 (reduce this by the number of additional query parameters),
- fix whitespace
@MTRichards
Copy link
Contributor

@DeepDiver1975 @bantu @karlitschek more eyes?

@karlitschek
Copy link
Contributor

👍

@ghost
Copy link

ghost commented Oct 29, 2013

Test passed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1835/

@butonic
Copy link
Member Author

butonic commented Oct 29, 2013

@bantu @DeepDiver1975 cleaned up the last whitespace changes.

@DeepDiver1975
Copy link
Member

I'm getting this error on Oracle:
[Error message: Unable to bind to missing placeholder: 999]

And it looks like errors are not properly handled:

[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP Fatal error:  Call to undefined method MDB2_Error::fetchRow() in /home/deepdiver/Development/ownCloud/stable5/apps/files_sharing/lib/cache.php on line 292, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP Stack trace:, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   1. {main}() /home/deepdiver/Development/ownCloud/stable5/index.php:0, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   2. OC::handleRequest() /home/deepdiver/Development/ownCloud/stable5/index.php:28, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   3. OC_Router->match($url = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/base.php:629, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   4. call_user_func(*uninitialized*, *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/router.php:127, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   5. __lambda_func($param = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/router.php:127, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   6. require_once() /home/deepdiver/Development/ownCloud/stable5/lib/route.php(113) : runtime-created function:1, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   7. OC_Search::search($query = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/search/ajax/search.php:30, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   8. OC_Search_Provider_File->search($query = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/search.php:56, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP   9. OC\\Files\\Filesystem::search($query = *uninitialized*, *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/search/provider/file.php:5, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP  10. OC\\Files\\View->search($query = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/files/filesystem.php:558, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP  11. OC\\Files\\View->searchCommon($query = *uninitialized*, $method = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/files/view.php:962, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP  12. OC\\Files\\Cache\\Shared_Cache->search($pattern = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/lib/files/view.php:1004, referer: http://localhost/oc/stable5/index.php/apps/files
[Wed Oct 30 14:01:19 2013] [error] [client ::1] PHP  13. OC\\Files\\Cache\\Shared_Cache->searchWithWhere($sqlwhere = *uninitialized*, $wherevalue = *uninitialized*, $chunksize = *uninitialized*) /home/deepdiver/Development/ownCloud/stable5/apps/files_sharing/lib/cache.php:231, referer: http://localhost/oc/stable5/index.php/apps/files

@butonic
Copy link
Member Author

butonic commented Oct 30, 2013

@DeepDiver1975 seems I was counting the wrong array. also need to fix this in master

@ghost
Copy link

ghost commented Oct 30, 2013

Test passed.
Refer to this link for build results: https://ci.owncloud.org/job/pull-request-analyser/1850/

@MTRichards
Copy link
Contributor

@karlitschek @DeepDiver1975 eyes please!

@schiessle
Copy link
Contributor

I tested it, works as expected 👍

karlitschek pushed a commit that referenced this pull request Oct 30, 2013
…s_to_stable5

backport search in shared files to stable5
@karlitschek karlitschek merged commit c251ccf into stable5 Oct 30, 2013
@karlitschek karlitschek deleted the backport_search_in_shared_files_to_stable5 branch October 30, 2013 16:42
@MTRichards
Copy link
Contributor

@bboule

@DeepDiver1975
Copy link
Member

just to confirm: retested on oracle and it works

@lock lock bot locked as resolved and limited conversation to collaborators Aug 26, 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