SQLite

Check-in [1965b85318]
Login

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

Overview
Comment:Add a missing call to sqlite3PagerSync() removed by [ce552d975] to the backup code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1965b85318c1fac62fae9691059021b298c17dde
User & Date: dan 2011-01-25 18:19:25.000
Context
2011-01-25
18:30
Fix new compiler warnings in pcache1.c that were introduced by the recent performance enhancement patches of [e14649301138b684]. (check-in: c17703ec1e user: drh tags: trunk)
18:19
Add a missing call to sqlite3PagerSync() removed by [ce552d975] to the backup code. (check-in: 1965b85318 user: dan tags: trunk)
16:48
Make sure the return code from doing an xSync is correctly initialized so that a valid return code is produced regardless of the path taken through the logic. (check-in: f12b5d7685 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/backup.c.
445
446
447
448
449
450
451










452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471




472
473
474
475
476
477
478
        i64 iEnd;

        assert( pFile );
        assert( (i64)nDestTruncate*(i64)pgszDest >= iSize || (
              nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1)
           && iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest
        ));










        iEnd = MIN(PENDING_BYTE + pgszDest, iSize);
        for(
          iOff=PENDING_BYTE+pgszSrc; 
          rc==SQLITE_OK && iOff<iEnd; 
          iOff+=pgszSrc
        ){
          PgHdr *pSrcPg = 0;
          const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);
          rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
          if( rc==SQLITE_OK ){
            u8 *zData = sqlite3PagerGetData(pSrcPg);
            rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);
          }
          sqlite3PagerUnref(pSrcPg);
        }
        if( rc==SQLITE_OK ){
          rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1);
          if( rc==SQLITE_OK ){
            rc = backupTruncateFile(pFile, iSize);
          }




        }
      }else{
        rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0);
      }
  
      /* Finish committing the transaction to the destination database. */
      if( SQLITE_OK==rc







>
>
>
>
>
>
>
>
>
>
















<
<
|
|
>
>
>
>







445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477


478
479
480
481
482
483
484
485
486
487
488
489
490
        i64 iEnd;

        assert( pFile );
        assert( (i64)nDestTruncate*(i64)pgszDest >= iSize || (
              nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1)
           && iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest
        ));

        /* This call ensures that all data required to recreate the original
        ** database has been stored in the journal for pDestPager and the
        ** journal synced to disk. So at this point we may safely modify
        ** the database file in any way, knowing that if a power failure
        ** occurs, the original database will be reconstructed from the 
        ** journal file.  */
        rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1);

        /* Write the extra pages and truncate the database file as required. */
        iEnd = MIN(PENDING_BYTE + pgszDest, iSize);
        for(
          iOff=PENDING_BYTE+pgszSrc; 
          rc==SQLITE_OK && iOff<iEnd; 
          iOff+=pgszSrc
        ){
          PgHdr *pSrcPg = 0;
          const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);
          rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
          if( rc==SQLITE_OK ){
            u8 *zData = sqlite3PagerGetData(pSrcPg);
            rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);
          }
          sqlite3PagerUnref(pSrcPg);
        }
        if( rc==SQLITE_OK ){


          rc = backupTruncateFile(pFile, iSize);
        }

        /* Sync the database file to disk. */
        if( rc==SQLITE_OK ){
          rc = sqlite3PagerSync(pDestPager);
        }
      }else{
        rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0);
      }
  
      /* Finish committing the transaction to the destination database. */
      if( SQLITE_OK==rc