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

Prevent WAL locking by resetting prepared statements after use #129

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

Conversation

digal
Copy link

@digal digal commented Jun 20, 2018

Should possibly fix unlimited WAL growing (like in #115)

Cached prepared statements in _dbPrepareStmt are not reset until next call, so both automatic and manual checkpoints are failing to occur,
causing WAL to grow and never to be merged into main DB file (see http://sqlite.1065341.n5.nabble.com/sqlite3-wal-checkpoint-v2-returning-SQLITE-LOCKED-in-what-circumstances-td86662.html)

digal added 2 commits June 20, 2018 12:24
Should possibly fix unlimited WAL growing (like in ibireme#115)

Cached prepared statements in _dbPrepareStmt are not reset until next call, so both automatic and manual checkpoints are failing to occur,
causing WAL to grow and never to be merged into main DB file (see http://sqlite.1065341.n5.nabble.com/sqlite3-wal-checkpoint-v2-returning-SQLITE-LOCKED-in-what-circumstances-td86662.html)
@@ -429,11 +442,13 @@ - (NSData *)_dbGetValueWithKey:(NSString *)key {
const void *inline_data = sqlite3_column_blob(stmt, 0);
int inline_data_bytes = sqlite3_column_bytes(stmt, 0);
if (!inline_data || inline_data_bytes <= 0) return nil;
sqlite3_reset(stmt);

Choose a reason for hiding this comment

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

sqlite3_reset(stmt); should add before line:444 if (!inline_data || inline_data_bytes <= 0) return nil;

wbcyclist added a commit to wbcyclist/YYCache that referenced this pull request May 21, 2020
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