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

Add ability to set an int64 file control #1298

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jonstacks
Copy link
Contributor

Similar to #1000,

We are using vfs=memdb and would like to use the SQLITE_FCNTL_SIZE_LIMIT opcode with sqlite3_file_control:

The SQLITE_FCNTL_SIZE_LIMIT opcode is used by in-memory VFS that implements sqlite3_deserialize() to set an upper bound on the size of the in-memory database. The argument is a pointer to a sqlite3_int64. If the integer pointed to is negative, then it is filled in with the current limit. Otherwise the limit is set to the larger of the value of the integer pointed to and the current database size. The integer pointed to is set to the new limit.

Calling the existing SetFileControlInt method when go decides that ints are int64 based on your architecture seem to overflow the C.int and in our case set the size limit of our in-memory VFS to 0. This adds a new SetFileControlInt64 to be used with op codes that expect a sqlite3_int64.

sqlite3.go Outdated Show resolved Hide resolved
@rittneje
Copy link
Collaborator

Calling the existing SetFileControlInt method when go decides that ints are int64 based on your architecture seem to overflow the C.int and in our case set the size limit of our in-memory VFS to 0.

I filed #1299 for this bug.

sqlite3.go Outdated Show resolved Hide resolved
@jonstacks
Copy link
Contributor Author

CIFuzz failure was caused by #1300. I'll rebase this and hopefully that fixes the issue 🤞

@jonstacks jonstacks force-pushed the set-file-control-int64 branch from 80b9472 to 3e99090 Compare November 27, 2024 16:31
Copy link
Collaborator

@rittneje rittneje left a comment

Choose a reason for hiding this comment

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

LGTM
@mattn any concerns on your end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants