SQLite

Check-in [be114bdf9b]
Login

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

Overview
Comment:When running a checkpoint while in locking_mode=EXCLUSIVE, be sure to move the wal-index lock to UNLOCK from READ prior to promoting to CHECKPOINT.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: be114bdf9bb98c7287f8cb54340c630b0c412e9d
User & Date: drh 2010-05-07 20:34:17.000
Context
2010-05-10
11:20
Enhance the OP_JournalMode opcode with an ignore-errors option and use that option the ATTACH command. (check-in: 0bdea4cfbd user: drh tags: trunk)
2010-05-07
20:34
When running a checkpoint while in locking_mode=EXCLUSIVE, be sure to move the wal-index lock to UNLOCK from READ prior to promoting to CHECKPOINT. (check-in: be114bdf9b user: drh tags: trunk)
20:02
Change the xShmOpen() method of the VFS to take the database file name as its argument, not the WAL file name. Also fix some unrelated compiler warnings. (check-in: a65c293926 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wal.c.
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355






1356
1357
1358
1359
1360
1361
1362
  u8 *zBuf,                       /* Temporary buffer to use */
  int (*xBusyHandler)(void *),    /* Pointer to busy-handler function */
  void *pBusyHandlerArg           /* Argument to pass to xBusyHandler */
){
  int rc;                         /* Return code */
  int isChanged = 0;              /* True if a new wal-index header is loaded */

  assert( pWal->lockState==SQLITE_SHM_UNLOCK );
  assert( pWal->pWiData==0 );

  /* Get the CHECKPOINT lock */






  do {
    rc = walSetLock(pWal, SQLITE_SHM_CHECKPOINT);
  }while( rc==SQLITE_BUSY && xBusyHandler(pBusyHandlerArg) );
  if( rc!=SQLITE_OK ){
    walSetLock(pWal, SQLITE_SHM_UNLOCK);
    return rc;
  }







<



>
>
>
>
>
>







1345
1346
1347
1348
1349
1350
1351

1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
  u8 *zBuf,                       /* Temporary buffer to use */
  int (*xBusyHandler)(void *),    /* Pointer to busy-handler function */
  void *pBusyHandlerArg           /* Argument to pass to xBusyHandler */
){
  int rc;                         /* Return code */
  int isChanged = 0;              /* True if a new wal-index header is loaded */


  assert( pWal->pWiData==0 );

  /* Get the CHECKPOINT lock */
  if( pWal->lockState!=SQLITE_SHM_UNLOCK ){
    /* This can occur when locking_mode=EXCLUSIVE */
    assert( pWal->lockState==SQLITE_SHM_READ
         || pWal->lockState==SQLITE_SHM_READ_FULL );
    walSetLock(pWal, SQLITE_SHM_UNLOCK);
  }
  do {
    rc = walSetLock(pWal, SQLITE_SHM_CHECKPOINT);
  }while( rc==SQLITE_BUSY && xBusyHandler(pBusyHandlerArg) );
  if( rc!=SQLITE_OK ){
    walSetLock(pWal, SQLITE_SHM_UNLOCK);
    return rc;
  }