SQLite

Check-in [e7be3183eb]
Login

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

Overview
Comment:Enclose the sqlite3WalSnapshotRecover() routine within
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | serializable-snapshot
Files: files | file ages | folders
SHA1: e7be3183eb25e0f9f04b9e251ff37fa5e50cc1a7
User & Date: drh 2016-11-22 21:11:59.294
Context
2016-11-22
22:23
Merge bug fixes and enhancements from trunk. (Closed-Leaf check-in: e2c4bdf54f user: drh tags: serializable-snapshot)
21:11
Enclose the sqlite3WalSnapshotRecover() routine within (check-in: e7be3183eb user: drh tags: serializable-snapshot)
2016-11-19
18:31
Remove the requirement to open the wal file before sqlite3_snapshot_recover() is called. Also add some comments to new functions. (check-in: 28393c413c user: dan tags: serializable-snapshot)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wal.c.
2375
2376
2377
2378
2379
2380
2381

2382
2383
2384
2385
2386
2387
2388
  }else{
    assert( mxReadMark<=pWal->hdr.mxFrame );
    pWal->readLock = (i16)mxI;
  }
  return rc;
}


/*
** Attempt to reduce the value of the WalCkptInfo.nBackfillAttempted 
** variable so that older snapshots can be accessed. To do this, loop
** through all wal frames from nBackfillAttempted to (nBackfill+1), 
** comparing their content to the corresponding page with the database
** file, if any. Set nBackfillAttempted to the frame number of the
** first frame for which the wal file content matches the db file.







>







2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
  }else{
    assert( mxReadMark<=pWal->hdr.mxFrame );
    pWal->readLock = (i16)mxI;
  }
  return rc;
}

#ifdef SQLITE_ENABLE_SNAPSHOT
/*
** Attempt to reduce the value of the WalCkptInfo.nBackfillAttempted 
** variable so that older snapshots can be accessed. To do this, loop
** through all wal frames from nBackfillAttempted to (nBackfill+1), 
** comparing their content to the corresponding page with the database
** file, if any. Set nBackfillAttempted to the frame number of the
** first frame for which the wal file content matches the db file.
2450
2451
2452
2453
2454
2455
2456

2457
2458
2459
2460
2461
2462
2463
      sqlite3_free(pBuf2);
    }
    walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);
  }

  return rc;
}


/*
** Begin a read transaction on the database.
**
** This routine used to be called sqlite3OpenSnapshot() and with good reason:
** it takes a snapshot of the state of the WAL and wal-index for the current
** instant in time.  The current thread will continue to use this snapshot.







>







2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
      sqlite3_free(pBuf2);
    }
    walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);
  }

  return rc;
}
#endif /* SQLITE_ENABLE_SNAPSHOT */

/*
** Begin a read transaction on the database.
**
** This routine used to be called sqlite3OpenSnapshot() and with good reason:
** it takes a snapshot of the state of the WAL and wal-index for the current
** instant in time.  The current thread will continue to use this snapshot.