Repository navigation
Closed
Description
Hi there,
after upgrading to 4.5.0 I noticied that some of my backup tools stopped syncing data to OC.
How to reproduce:
- Clean install of owncloud 4.5.1a
- mkdir 1; cd 1
- generate 998 files: a=1 ; while [ $a -lt 999 ] ; do touch
$a ; a=$ (($a+1)) ; done - check directory via webfrontend
- check directory via WebDAV (in browser) (both are fine)
- generate a 999th file
- check directory via webfrontend -> all 999 files are fine
- check directory via WebDAV (in browser):
DB Error: "SQLSTATE[HY000]: General error: 1 too many SQL variables"
Offending command was: SELECT * FROM "oc_properties" WHERE "userid" = ? AND "propertypath" IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?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,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
This was checked against a clean install of 4.5.1a. A clean install of 4.0.8 works fine for me. Updating SabreDAV to 1.6.5 does not change the problem.
Regards,
Markus
Activity
DeepDiver1975 commentedon Nov 5, 2012
@evert
Can you help us out on this? THX a lot!
evert commentedon Nov 5, 2012
Where's the code for this?
DeepDiver1975 commentedon Nov 5, 2012
Hehe - took me some time to find the code.
Actually this is not SabreDAV related - @evert sorry for the noise.
The problem is here:
https://github.com/owncloud/core/blob/master/lib/connector/sabre/directory.php#L128
$placeholders needs to be chunked in packs of 1000 items max.
evert commentedon Nov 5, 2012
I had a hunch.. It actually looks like you may be able to use a LIKE query instead though..
DeepDiver1975 commentedon Nov 5, 2012
Looks like
scroogie commentedon Nov 5, 2012
Would the shared files need to be special cased then? (When using a prefix scan). Btw, I think mysql is able to use an index in a LIKE prefix% query.
dragotin commentedon Nov 5, 2012
@icewind1991
@DeepDiver1975
This patch solves the problem for me:
Please review deeply, I am not very much into PHP. It loops over all the children which should be fine as long the prepare is outside the loop. IN should be used carefully.
DeepDiver1975 commentedon Nov 5, 2012
I'll do some test on this.
DeepDiver1975 commentedon Nov 5, 2012
My setup: apache + sqlite
current implementation: 0.1331 sec.
proposal above: 0.5020 sec
chunked in packs of 999: 0.3075 sec
scroogie commentedon Nov 5, 2012
How many records does the table have in the above tests?
DeepDiver1975 commentedon Nov 5, 2012
I did setup a clean new installation for testing this: 998 entries.