0
int iReturn = sqlite3_wal_checkpoint_v2(m_poDB, NULL, SQLITE_CHECKPOINT_FULL, &iSizeOfWalLog, &iNumOfCheckpointedFrames);

returns with iReturn = 5 (SQLITE_BUSY). The writer wakes up now and then, adds or deletes a number of rows to the database, does a checkpoint and goes to sleep again.

Question 1: How is that possible if I use WAL mode and have 4 readers and one writer?

Question 2: In the log messages I have seen that the checkpointing often works but only sometimes reports SQLITE_BUSY. Should I be concerned if it works sometimes but not always? Can this corrupt the database?

Question 3: Should I not use sqlite3_wal_checkpoint_v2 or SQLITE_CHECKPOINT_FULL?

Fabian
  • 4,001
  • 4
  • 28
  • 59

1 Answers1

0

A full checkpoint requires that there are no concurrent readers or writers.

You could try to increase your busy timeout, but if you try to do the checkpoint regularly, you could get away with ignoring single failures.

CL.
  • 173,858
  • 17
  • 217
  • 259