/ Check-in [e2729d62]
Login

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

Overview
Comment:Sync the database file in sqlite3_ckpt_close(), even if the checkpoint has not finished.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ota-update
Files: files | file ages | folders
SHA1: e2729d623c6e9d0b3049049f3f3051bbb479184f
User & Date: dan 2014-10-22 11:30:08
Context
2014-10-22
15:33
Add tests to check error handling in OTA. check-in: ec7321ae user: dan tags: ota-update
11:30
Sync the database file in sqlite3_ckpt_close(), even if the checkpoint has not finished. check-in: e2729d62 user: dan tags: ota-update
2014-10-21
19:35
Test that sqlite3ota_open() works with URI paths. Fix some other issues. check-in: 6fd09854 user: dan tags: ota-update
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wal.c.

1760
1761
1762
1763
1764
1765
1766

1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781



1782
1783
1784
1785
1786
1787
1788
}

static int walCheckpointFinalize(WalCkpt *p){
  if( p->pIter ){
    int rc = p->rc;
    Wal *pWal = p->pWal;


    /* If work was completed */
    if( p->pIter && rc==SQLITE_DONE ){
      rc = SQLITE_OK;
      if( p->mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
        i64 szDb = pWal->hdr.nPage*(i64)p->szPage;
        testcase( IS_BIG_INT(szDb) );
        rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
        if( rc==SQLITE_OK && p->sync_flags ){
          rc = sqlite3OsSync(pWal->pDbFd, p->sync_flags);
        }
      }
      if( rc==SQLITE_OK ){
        p->pInfo->nBackfill = p->mxSafeFrame;
      }
      p->rc = rc;



    }

    /* Release the reader lock held while backfilling */
    walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
    walIteratorFree(p->pIter);
    p->pIter = 0;
  }







>
|
<













>
>
>







1760
1761
1762
1763
1764
1765
1766
1767
1768

1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
}

static int walCheckpointFinalize(WalCkpt *p){
  if( p->pIter ){
    int rc = p->rc;
    Wal *pWal = p->pWal;

    if( rc==SQLITE_DONE ){
      /* If work was completed */

      rc = SQLITE_OK;
      if( p->mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
        i64 szDb = pWal->hdr.nPage*(i64)p->szPage;
        testcase( IS_BIG_INT(szDb) );
        rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
        if( rc==SQLITE_OK && p->sync_flags ){
          rc = sqlite3OsSync(pWal->pDbFd, p->sync_flags);
        }
      }
      if( rc==SQLITE_OK ){
        p->pInfo->nBackfill = p->mxSafeFrame;
      }
      p->rc = rc;
    }else if( rc==SQLITE_OK && p->sync_flags ){
      /* If work was not completed, but no error has occured. */
      p->rc = sqlite3OsSync(pWal->pDbFd, p->sync_flags);
    }

    /* Release the reader lock held while backfilling */
    walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);
    walIteratorFree(p->pIter);
    p->pIter = 0;
  }