-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Increase maximum SQLite variables count to 32766 #11696
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
Conversation
This workaround won't be required anymore after https://github.com/mattn/go-sqlite3 is updated to SQLite3 3.32.0 (currently at 3.28.0) or newer, however this PR is backportable into 1.12. |
This PR also removes |
Wondering if this overrides default |
Good call on running about the default cgo flags - I think that this could well override them but we'd need to check the documentation for cgo ... However, it certainly overrides any user provided flags so we would need to use the makefile only set if not already set notation for it. |
Updated it to behave same as |
Sadly nothing interesting there.
Need to test it with enabled verbose to see what commands are passed exactly. |
Confirmed that it removes default |
You can pull in the defaults from $(GO) build CGO_CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=32766 $(shell $(GO) env CGO_CFLAGS) $(CGO_CFLAGS)" I would do this only in the targets that need it because otherwise you'd be adding +150ms to unrelated make targets too. Edit: updated to use |
Another alternative: CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) -DSQLITE_MAX_VARIABLE_NUMBER=32766
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well at some point if you have that mouch issues & repos ... you should move away from sqlite in general ...
@silverwind That is fine for Makefile but we also need something for Dockerfile |
Something like this:
I guess we don't want to inherit CGO_CFLAGS from the host system during the docker build because those defaults could be platform-specific (e.g. ARM). |
I'd actually call it |
You assume docker is being built from makefile, but nothing forces you to do that; you can just |
Dockerfile uses makefile https://github.com/go-gitea/gitea/blob/master/Dockerfile#L22 so these lines https://github.com/go-gitea/gitea/pull/11696/files#diff-b67911656ef5d18c4ae36cb6741b7965R38 would be used. You can confirm this behaviour by reviewing the CI run https://drone.gitea.io/go-gitea/gitea/26552/5/2 (specifically L457, but I am unable to link to a specific line in a build in drone) |
Dockerfile
Outdated
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ | ||
&& make clean-all build | ||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi && \ | ||
export CGO_CFLAGS="$(go env CGO_CFLAGS) -DSQLITE_MAX_VARIABLE_NUMBER=32766 $CGO_EXTRA_CFLAGS" && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this $CGO_EXTRA_CFLAGS duplicating with the variable before? Should probably remove it or fix inheritance from the main makefile which seems to not work based on @techknowlogick's link above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, let me revert the changes to dockerfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed changes, and will review CI output before merge.
ping LG-TM |
@CirnoT please send backport :) |
per https://www.sqlite.org/limits.html Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit a5aa5c5)
* Increase maximum SQLite variables count to 32766 (#11696) per https://www.sqlite.org/limits.html Co-authored-by: techknowlogick <techknowlogick@gitea.io> (cherry picked from commit a5aa5c5) * Fix missing CGO_EXTRA_FLAGS build arg for docker Co-authored-by: techknowlogick <techknowlogick@gitea.io>
per https://www.sqlite.org/limits.html Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Increase limit of variables in a query for SQLite to 32766 via CGO_CFLAGS
SQLITE_MAX_VARIABLE_NUMBER
This puts our SQLite in same state as versions 3.32.0+ (since 2020-05-22)
Fixes #10690
Fixes #11236
Fixes #7750
Closes #11664
Ref. https://www.sqlite.org/limits.html
Ref. https://github.com/mattn/go-sqlite3#compilation
Ref. https://raw.githubusercontent.com/mattn/go-sqlite3/master/sqlite3-binding.c