-
Notifications
You must be signed in to change notification settings - Fork 683
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
deletecontent
command on a large topic + force_delete
option can fail with "too many SQL variables" error
#7697
Comments
This "too many SQL variables" is dependent on the version and compilation flags used when creating the SQLite application. Ultimately, the only solution in code would probably be to chunk queries - possibly by monkey patching |
We shouldn't go around monkey patching sqlite3 - we should just properly batch our queries. We do some similar things here: https://github.com/learningequality/kolibri/blob/release-v0.14.x/kolibri/core/content/utils/annotation.py#L183 it's just about propagating this across all the places we work with potentially large numbers of SQL parameters. |
Hi @rtibbles, There are two methods to solve this issue.
I will say 2nd works better as we could increase the limit on variables but that may arise major issues during the new installation or any other SQL operations. P.S. I am new to this, please let me know if I am going on the correct path or not. |
Yes - deleting in batches is the correct approach, the parameter limit is not changeable because it's a compile time flag on SQLite. Because Django uses SQL parameters for every query it does (to prevent injection attacks) we can't do a generic approach to this, and it has to be done on a query by query basis to ensure that we are batching the correct parameters. In this case, it is probably because
|
Hi @rtibbles, Is there any other way to checkout/reproduce this issue error, or just as @jonboiser suggested? |
Yes, I think this is the most reliable way to reproduce it. |
I am getting an issue deleting the resources as suggested by @jonboiser above. The resource isn't deleted and I get a waiting status for a too long time. Would like to know why is this happening and what can I do to make it work out. Due to this, I could not work on this issue too. |
@iharshit009 it looks like the task runner is not running - what command did you use to start Kolibri? |
I used |
Need to also run the task runner using the 'services' command https://github.com/learningequality/kolibri/blob/release-v0.14.x/package.json#L23 |
Originally posted by @radinamatic in #7669 (comment)
Observed behavior
On Windows 7 VM running Kolibri 0.14.4-rc1, if you attempt to delete the "Khan Academy > Arithmetic" topic and also select the "Delete everywhere" option on the modal. The task will eventually fail. The traceback indicates that it might be due to the "Delete everywhere" (aka force deletion) option, which causes the SQL query to become too large.
Traceback from logs:
Different versions of this scenario don't produce this result, namely
Expected behavior
Ideally, no errors deleting large topics with the "delete everywhere" option
User-facing consequences
…
Errors and logs
daemon.txt
kolibri.txt
Steps to reproduce
…
Context
The text was updated successfully, but these errors were encountered: