SQLite

Check-in [e83d3a2a4e]
Login

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

Overview
Comment:Improved testability.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | wal-overwrite-frames
Files: files | file ages | folders
SHA1: e83d3a2a4e06665e8a056f63063bd6df03f063b9
User & Date: drh 2016-01-11 00:52:32.218
Context
2016-01-11
08:12
Add a test case to waloverwrite.test to check that savepoint rollback does not cause a problem. (Closed-Leaf check-in: 87dae56c32 user: dan tags: wal-overwrite-frames)
00:52
Improved testability. (check-in: e83d3a2a4e user: drh tags: wal-overwrite-frames)
2016-01-09
23:55
All WAL frame overwrites even if there are active savepoints. This is safe because a ROLLBACK TO will cause all reverted pages to be rewritten to the WAL file prior to COMMIT. (check-in: 99b31a6b49 user: drh tags: wal-overwrite-frames)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wal.c.
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067

    /* Check if this page has already been written into the wal file by
    ** the current transaction. If so, overwrite the existing frame and
    ** set Wal.writeLock to WAL_WRITELOCK_RECKSUM - indicating that 
    ** checksums must be recomputed when the transaction is committed.  */
    if( iFirst && (p->pDirty || isCommit==0) ){
      u32 iWrite = 0;
      rc = sqlite3WalFindFrame(pWal, p->pgno, &iWrite);
      if( rc ) return rc;
      if( iWrite>=iFirst ){
        i64 iOff = walFrameOffset(iWrite, szPage) + WAL_FRAME_HDRSIZE;
        if( pWal->iReCksum==0 || iWrite<pWal->iReCksum ){
          pWal->iReCksum = iWrite;
        }
        rc = sqlite3OsWrite(pWal->pWalFd, p->pData, szPage, iOff);
        if( rc ) return rc;







|
|







3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067

    /* Check if this page has already been written into the wal file by
    ** the current transaction. If so, overwrite the existing frame and
    ** set Wal.writeLock to WAL_WRITELOCK_RECKSUM - indicating that 
    ** checksums must be recomputed when the transaction is committed.  */
    if( iFirst && (p->pDirty || isCommit==0) ){
      u32 iWrite = 0;
      VVA_ONLY(rc =) sqlite3WalFindFrame(pWal, p->pgno, &iWrite);
      assert( rc==SQLITE_OK || iWrite==0 );
      if( iWrite>=iFirst ){
        i64 iOff = walFrameOffset(iWrite, szPage) + WAL_FRAME_HDRSIZE;
        if( pWal->iReCksum==0 || iWrite<pWal->iReCksum ){
          pWal->iReCksum = iWrite;
        }
        rc = sqlite3OsWrite(pWal->pWalFd, p->pData, szPage, iOff);
        if( rc ) return rc;