SQLite

Check-in [dd19105aa9]
Login

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

Overview
Comment:Ignore malloc failures within the WAL file truncation attempt for journal_size_limit.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dd19105aa9521ffc0edcf16b84c064d5ebad55d7
User & Date: drh 2011-05-25 20:25:10.559
Context
2011-05-25
23:18
Fix some minor and harmless compiler warnings. (check-in: a4755e7088 user: drh tags: trunk)
20:25
Ignore malloc failures within the WAL file truncation attempt for journal_size_limit. (check-in: dd19105aa9 user: drh tags: trunk)
18:46
Fix a case where a malloc() error could lead to mismatched virtual-table xBegin/xCommit/xRollback callbacks. (check-in: d807304a69 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wal.c.
2535
2536
2537
2538
2539
2540
2541

2542
2543
2544
2545

2546
2547
2548
2549
2550
2551
2552

        /* Limit the size of WAL file if the journal_size_limit PRAGMA is
        ** set to a non-negative value.  Log errors encountered
        ** during the truncation attempt. */
        if( pWal->mxWalSize>=0 ){
          i64 sz;
          int rx;

          rx = sqlite3OsFileSize(pWal->pWalFd, &sz);
          if( rx==SQLITE_OK && (sz > pWal->mxWalSize) ){
            rx = sqlite3OsTruncate(pWal->pWalFd, pWal->mxWalSize);
          }

          if( rx ){
            sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName);
          }
        }

        pWal->nCkpt++;
        pWal->hdr.mxFrame = 0;







>




>







2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554

        /* Limit the size of WAL file if the journal_size_limit PRAGMA is
        ** set to a non-negative value.  Log errors encountered
        ** during the truncation attempt. */
        if( pWal->mxWalSize>=0 ){
          i64 sz;
          int rx;
          sqlite3BeginBenignMalloc();
          rx = sqlite3OsFileSize(pWal->pWalFd, &sz);
          if( rx==SQLITE_OK && (sz > pWal->mxWalSize) ){
            rx = sqlite3OsTruncate(pWal->pWalFd, pWal->mxWalSize);
          }
          sqlite3EndBenignMalloc();
          if( rx ){
            sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName);
          }
        }

        pWal->nCkpt++;
        pWal->hdr.mxFrame = 0;