Skip to content

Prevent WAL locking by resetting prepared statements after use#129

Open
digal wants to merge 4 commits intoibireme:masterfrom
digal:wal-lock-fix
Open

Prevent WAL locking by resetting prepared statements after use#129
digal wants to merge 4 commits intoibireme:masterfrom
digal:wal-lock-fix

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)
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

Comments