Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty() with sqlite3WalUndo(). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | wal |
Files: | files | file ages | folders |
SHA1: |
a8f958be804ee05c4137b3cd110db344 |
User & Date: | dan 2010-04-30 09:52:18.000 |
Context
2010-04-30
| ||
10:06 | Add missing mutexes to unixShmClose(). (check-in: a4741cb54d user: dan tags: wal) | |
09:52 | Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty() with sqlite3WalUndo(). (check-in: a8f958be80 user: dan tags: wal) | |
09:32 | Add a missing walIndexUnmap() to sqlite3WalSnapshotOpen(). (check-in: 72b95fde15 user: dan tags: wal) | |
Changes
Changes to src/os_unix.c.
︙ | ︙ | |||
4794 4795 4796 4797 4798 4799 4800 | /* Access to the unixShmFile object is serialized by the caller */ assert( sqlite3_mutex_held(pFile->mutex) ); /* Compute locks held by sibling connections */ for(pX=pFile->pFirst; pX; pX=pX->pNext){ if( pX==p ) continue; | | | 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 | /* Access to the unixShmFile object is serialized by the caller */ assert( sqlite3_mutex_held(pFile->mutex) ); /* Compute locks held by sibling connections */ for(pX=pFile->pFirst; pX; pX=pX->pNext){ if( pX==p ) continue; assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 ); allMask |= pX->sharedMask; } /* Unlock the system-level locks */ if( (unlockMask & allMask)!=unlockMask ){ rc = unixShmSystemLock(pFile, F_UNLCK, unlockMask & ~allMask); }else{ |
︙ | ︙ |
Changes to src/pager.c.
︙ | ︙ | |||
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 | if( rc==SQLITE_OK ){ pPager->xReiniter(pPg); } sqlite3PagerUnref(pPg); } } return rc; } /* ** This function is called to rollback a transaction on a WAL database. */ static int pagerRollbackWal(Pager *pPager){ int rc; /* Return Code */ PgHdr *pList; /* List of dirty pages to revert */ | > > > > > > > > > > < < < < < < < < < < < < | 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 | if( rc==SQLITE_OK ){ pPager->xReiniter(pPg); } sqlite3PagerUnref(pPg); } } /* Normally, if a transaction is rolled back, any backup processes are ** updated as data is copied out of the rollback journal and into the ** database. This is not generally possible with a WAL database, as ** rollback involves simply truncating the log file. Therefore, if one ** or more frames have already been written to the log (and therefore ** also copied into the backup databases) as part of this transaction, ** the backups must be restarted. */ sqlite3BackupRestart(pPager->pBackup); return rc; } /* ** This function is called to rollback a transaction on a WAL database. */ static int pagerRollbackWal(Pager *pPager){ int rc; /* Return Code */ PgHdr *pList; /* List of dirty pages to revert */ /* For all pages in the cache that are currently dirty or have already ** been written (but not committed) to the log file, do one of the ** following: ** ** + Discard the cached page (if refcount==0), or ** + Reload page content from the database (if refcount>0). */ |
︙ | ︙ |
Changes to src/wal.c.
︙ | ︙ | |||
825 826 827 828 829 830 831 | ** ** If the wal-index header is successfully read, return SQLITE_OK. ** Otherwise an SQLite error code. */ static int walIndexReadHdr(Wal *pWal, int *pChanged){ int rc; | | | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | ** ** If the wal-index header is successfully read, return SQLITE_OK. ** Otherwise an SQLite error code. */ static int walIndexReadHdr(Wal *pWal, int *pChanged){ int rc; assert( pWal->lockState>=SQLITE_SHM_READ ); walIndexMap(pWal); /* First try to read the header without a lock. Verify the checksum ** before returning. This will almost always work. */ if( SQLITE_OK==walIndexTryHdr(pWal, pChanged) ){ return SQLITE_OK; |
︙ | ︙ | |||
1049 1050 1051 1052 1053 1054 1055 | pWal->hdr.iCheck1 = sqlite3Get4byte(&aCksum[0]); pWal->hdr.iCheck2 = sqlite3Get4byte(&aCksum[4]); } return rc; } | < < < < < < < < | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | pWal->hdr.iCheck1 = sqlite3Get4byte(&aCksum[0]); pWal->hdr.iCheck2 = sqlite3Get4byte(&aCksum[4]); } return rc; } /* ** Write a set of frames to the log. The caller must hold the write-lock ** on the log file (obtained using sqlite3WalWriteLock()). */ int sqlite3WalFrames( Wal *pWal, /* Wal handle to write to */ int nPgsz, /* Database page-size in bytes */ |
︙ | ︙ |
Changes to src/wal.h.
︙ | ︙ | |||
55 56 57 58 59 60 61 | ** position in the WAL */ u32 sqlite3WalSavepoint(Wal *pWal); /* Move the write position of the WAL back to iFrame. Called in ** response to a ROLLBACK TO command. */ int sqlite3WalSavepointUndo(Wal *pWal, u32 iFrame); | < < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | ** position in the WAL */ u32 sqlite3WalSavepoint(Wal *pWal); /* Move the write position of the WAL back to iFrame. Called in ** response to a ROLLBACK TO command. */ int sqlite3WalSavepointUndo(Wal *pWal, u32 iFrame); /* Write a frame or frames to the log. */ int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int); /* Copy pages from the log to the database file */ int sqlite3WalCheckpoint( Wal *pWal, /* Write-ahead log connection */ sqlite3_file *pFd, /* File descriptor open on db file */ |
︙ | ︙ |