/ Check-in [0bf0fd24]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Always reset the pager before changing the codec.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:0bf0fd242b93c3bd308ab46db1be9edef141b89db07a0f5a4ed8b23c963da0d5
User & Date: drh 2018-10-11 16:38:56
Context
2018-10-11
16:53
Fix harmless compiler warnings in the CLI. check-in: 1916d291 user: drh tags: trunk
16:38
Always reset the pager before changing the codec. check-in: 0bf0fd24 user: drh tags: trunk
13:51
On the first connection to a WAL-mode database that was not cleanly shut down and contains a left-over -shm file, truncate the -shm file to 3 bytes instead of to 0 bytes. Avoiding a truncation to 0 means that system monitoring tools can better detect if a process illegitimately tries to truncate a -shm file. Such a rogue process might think it is being helpful by cleaning up old files, but there is a race condition that can cause damage to the database. check-in: 90cf32cd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

7017
7018
7019
7020
7021
7022
7023

7024
7025
7026
7027
7028
7029
7030
void sqlite3PagerSetCodec(
  Pager *pPager,
  void *(*xCodec)(void*,void*,Pgno,int),
  void (*xCodecSizeChng)(void*,int,int),
  void (*xCodecFree)(void*),
  void *pCodec
){

  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);
  pPager->xCodec = pPager->memDb ? 0 : xCodec;
  pPager->xCodecSizeChng = xCodecSizeChng;
  pPager->xCodecFree = xCodecFree;
  pPager->pCodec = pCodec;
  setGetterMethod(pPager);
  pagerReportSize(pPager);







>







7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
void sqlite3PagerSetCodec(
  Pager *pPager,
  void *(*xCodec)(void*,void*,Pgno,int),
  void (*xCodecSizeChng)(void*,int,int),
  void (*xCodecFree)(void*),
  void *pCodec
){
  pager_reset(pPager);
  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);
  pPager->xCodec = pPager->memDb ? 0 : xCodec;
  pPager->xCodecSizeChng = xCodecSizeChng;
  pPager->xCodecFree = xCodecFree;
  pPager->pCodec = pCodec;
  setGetterMethod(pPager);
  pagerReportSize(pPager);