Lines Matching refs:Pager
5178 ** CAPI3REF: Enable Or Disable Shared Pager Cache
6529 ** memory used by all pager caches associated with the database connection.)^
6549 ** <dd>This parameter returns the number of pager cache hits that have
6555 ** <dd>This parameter returns the number of pager cache misses that have
8031 ** callback for the database handle. Each pager opened via the sqlite
8033 ** callback is currently invoked only from within pager.c.
8231 ** pager.h.
8350 SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
8847 /************** Include pager.h in the middle of sqliteInt.h *****************/
8848 /************** Begin file pager.h *******************************************/
8884 ** Each open file is managed by a separate instance of the "Pager" structure.
8886 typedef struct Pager Pager;
8898 ** roll back. See comments for function writeMasterJournal() in pager.c
8931 ** that make up the Pager sub-system API. See source code comments for
8935 /* Open and close a Pager connection. */
8938 Pager **ppPager,
8945 SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager);
8946 SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
8948 /* Functions used to configure a Pager object. */
8949 SQLITE_PRIVATE void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);
8950 SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int);
8951 SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int);
8952 SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int);
8953 SQLITE_PRIVATE void sqlite3PagerShrink(Pager*);
8954 SQLITE_PRIVATE void sqlite3PagerSetSafetyLevel(Pager*,int,int,int);
8955 SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int);
8956 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int);
8957 SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*);
8958 SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*);
8959 SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
8960 SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*);
8963 SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
8965 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
8972 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
8977 /* Functions used to manage pager transactions and savepoints. */
8978 SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*);
8979 SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int);
8980 SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int);
8981 SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*);
8982 SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager);
8983 SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*);
8984 SQLITE_PRIVATE int sqlite3PagerRollback(Pager*);
8985 SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n);
8986 SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
8987 SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager);
8989 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int*);
8990 SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager);
8991 SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager);
8992 SQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
8993 SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager);
8995 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager);
8998 /* Functions used to query pager state and configuration. */
8999 SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*);
9000 SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*);
9001 SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*);
9002 SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager*);
9003 SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager*);
9004 SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*);
9005 SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*);
9006 SQLITE_PRIVATE int sqlite3PagerNosync(Pager*);
9007 SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*);
9008 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*);
9009 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *);
9010 SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *);
9013 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
9025 SQLITE_PRIVATE int *sqlite3PagerStats(Pager*);
9026 SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*);
9036 /************** End of pager.h ***********************************************/
9069 Pager *pPager; /* The pager this page is part of */
9104 /* Create a new pager cache.
9173 /* Set and get the suggested cache-size for the specified pager-cache.
9176 ** the total number of pages cached by purgeable pager-caches to the sum
9429 ** actual data in the bytes used for locking. The pager never allocates
13434 Pager *pPager = sqlite3BtreePager(pBt);
13521 Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);
28606 /* The pager calls this method to signal that it has done
37811 ** held by the pager system. Memory in use by any SQLite pager allocated
38288 /************** Begin file pager.c *******************************************/
38300 ** This is the implementation of the page cache subsystem or "pager".
38302 ** The pager is used to access a database disk file. It implements
38304 ** is separate from the database file. The pager also implements file
38310 pager.c ***********************/
38362 ** There is one object of this type for each pager.
38428 ** by the pager layer on the database file.
38449 /************** Continuing where we left off in pager.c **********************/
38452 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
38553 ** PAGERID() takes a pointer to a Pager struct as its argument. The
38561 ** The Pager.eState variable stores the current 'state' of a pager. A
38562 ** pager may be in any one of the seven states shown in the following
38600 ** The pager starts up in this state. Nothing is guaranteed in this
38611 ** rollback (non-WAL) mode are met. Unless the pager is (or recently
38634 ** The pager moves to this state from READER when a write-transaction
38657 ** * The contents of the pager cache have not been modified.
38663 ** A pager moves from WRITER_LOCKED state to this state when a page is
38676 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
38692 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
38710 ** difficult to be sure that the in-memory pager state (cache contents,
38713 ** Temporary pager files may enter the ERROR state, but in-memory pagers
38722 ** file. To avoid this hazard, the pager switches into the ERROR state
38725 ** Once it has entered the ERROR state, any attempt to use the pager
38727 ** outstanding transactions have been abandoned, the pager is able to
38731 ** when a read-transaction is next opened on the pager (transitioning
38732 ** the pager into READER state). At that point the system has recovered
38735 ** Specifically, the pager jumps into the ERROR state if:
38749 ** persists, the pager enters the ERROR state via condition (1) above.
38755 ** read-only statement cannot leave the pager in an internally inconsistent
38758 ** * The Pager.errCode variable is set to something other than SQLITE_OK.
38760 ** last reference is dropped the pager should move back to OPEN state).
38761 ** * The pager is not an in-memory pager.
38766 ** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the
38773 ** executed), and when the pager is leaving the "error state".
38786 ** The Pager.eLock variable is almost always set to one of the
38797 ** VFS call is successful. This way, the Pager.eLock variable may be set
38805 ** The exception is when the database file is unlocked as the pager moves
38808 ** transition, by the same pager or any other). If the call to xUnlock()
38809 ** fails at this point and the pager is left holding an EXCLUSIVE lock, this
38822 ** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It
38825 ** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK
38830 ** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in
38860 ** are stored in the Pager.aSavepoint[] array, which is allocated and
38883 ** A open page cache is an instance of struct Pager. A description of
38888 ** The current 'state' of the pager object. See the comment and state
38889 ** diagram above for a description of the pager state.
38898 ** databases always have Pager.exclusiveMode==1, this tricks the pager
38946 ** is cleared anyway (and the pager will move to ERROR state).
38970 ** sub-journals are only used for in-memory pager files.
39009 ** that the database file is larger than the database image (Pager.dbSize),
39031 ** The Pager.errCode variable is only ever used in PAGER_ERROR state. It
39032 ** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode
39036 struct Pager {
39053 ** when the pager is first created or else only change when there is a
39056 ** the "state" of the pager, while other class members describe the
39057 ** "configuration" of the pager.
39059 u8 eState; /* Pager state (OPEN, READER, WRITER_LOCKED..) */
39110 char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */
39168 ** The journal header size for this pager. This is usually the same
39205 ** Return true if this pager uses a write-ahead log instead of the usual
39209 static int pagerUseWal(Pager *pPager){
39227 ** the internal state of the Pager object.
39229 static int assert_pager_state(Pager *p){
39230 Pager *pPager = p;
39256 ** this means an in-memory pager performs no IO at all, it cannot encounter
39260 ** is therefore not possible for an in-memory pager to enter the ERROR
39345 /* There must be at least one outstanding reference to the pager if
39346 ** in ERROR state. Otherwise the pager should have already dropped
39361 ** containing the state of the Pager object passed as an argument. This
39367 static char *print_pager_state(Pager *p){
39420 Pager *pPager = pPg->pPager;
39473 ** succeeds, set the Pager.eLock variable to match the (attempted) new lock.
39475 ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
39479 static int pagerUnlockDb(Pager *pPager, int eLock){
39499 ** Pager.eLock variable to the new locking state.
39501 ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
39506 static int pagerLockDb(Pager *pPager, int eLock){
39522 ** can be used with this pager. The optimization can be used if:
39538 static int jrnlBufferSize(Pager *pPager){
39592 Pager *pPager = pPg->pPager;
39605 ** When this is called the journal file for pager pPager must be open.
39674 ** Pager.journalOff Return value
39682 static i64 journalHdrOffset(Pager *pPager){
39698 ** within the current transaction (i.e. if Pager.journalOff==0).
39700 ** If doTruncate is non-zero or the Pager.journalSizeLimit variable is
39703 ** if the pager is not in no-sync mode, sync the journal file immediately
39706 ** If Pager.journalSizeLimit is set to a positive, non-zero value, and
39709 ** journal file to Pager.journalSizeLimit bytes. The journal file does
39715 static int zeroJournalHdr(Pager *pPager, int doTruncate){
39764 static int writeJournalHdr(Pager *pPager){
39803 ** * When the pager is in no-sync mode. Corruption can follow a
39840 ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next
39851 ** database page size. Since the zHeader buffer is only Pager.pageSize
39883 Pager *pPager, /* Pager object */
39895 /* Advance Pager.journalOff to the start of the next sector. If the
39943 ** journal header to zero. In this case, assume that the Pager.pageSize
39978 ** of Pager.sectorSize is restored at the end of that routine.
39989 ** Write the supplied master journal name into the journal file for pager
39991 ** thing written to a journal file. If the pager is in full-sync mode, the
40007 static int writeMasterJournal(Pager *pPager, const char *zMaster){
40054 /* If the pager is in peristent-journal mode, then the physical
40077 static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
40090 static void pager_reset(Pager *pPager){
40096 ** Free all structures in the Pager.aSavepoint[] array and set both
40097 ** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal
40098 ** if it is open and the pager is not in exclusive mode.
40100 static void releaseAllSavepoints(Pager *pPager){
40101 int ii; /* Iterator for looping through Pager.aSavepoint */
40119 static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
40135 ** This function is a no-op if the pager is in exclusive mode and not
40136 ** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN
40139 ** If the pager is not in exclusive-access mode, the database file is
40144 ** If the pager is in ERROR state when this function is called, the
40145 ** contents of the pager cache are discarded before switching back to
40146 ** the OPEN state. Regardless of whether the pager is in exclusive-mode
40151 static void pager_unlock(Pager *pPager){
40187 /* If the pager is in the ERROR state and the call to unlock the database
40197 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
40206 /* If Pager.errCode is set, the contents of the pager cache cannot be
40207 ** trusted. Now that there are no outstanding references to the pager,
40226 ** the pager to transition into the ERROR state may ahve occurred.
40227 ** The first argument is a pointer to the pager structure, the second
40228 ** the error-code about to be returned by a pager API function. The
40232 ** IOERR sub-codes, the pager enters the ERROR state and the error code
40233 ** is stored in Pager.errCode. While the pager remains in the ERROR state,
40234 ** all major API calls on the Pager will immediately return Pager.errCode.
40236 ** The ERROR state indicates that the contents of the pager-cache
40238 ** the contents of the pager-cache. If a transaction was active when
40243 static int pager_error(Pager *pPager, int rc){
40275 ** depends on whether or not the pager is running in exclusive mode and
40276 ** the current journal-mode (Pager.journalMode value), as follows:
40293 ** If the pager is running in exclusive mode, this method of finalizing
40295 ** DELETE and the pager is in exclusive mode, the method described under
40298 ** After the journal is finalized, the pager moves to PAGER_READER state.
40311 static int pager_end_transaction(Pager *pPager, int hasMaster){
40315 /* Do nothing if the pager does not have an open write transaction
40356 /* This branch may be executed with Pager.journalMode==MEMORY if
40413 ** If the pager has already entered the ERROR state, do not attempt
40416 ** the database file and move the pager back to OPEN state. If this
40418 ** connection to obtain a shared lock on the pager (which may be this one)
40421 ** If the pager has not already entered the ERROR state, but an IO or
40423 ** the pager to enter the ERROR state. Which will be cleared by the
40426 static void pagerUnlockAndRollback(Pager *pPager){
40460 static u32 pager_cksum(Pager *pPager, const u8 *aData){
40475 static void pagerReportSize(Pager *pPager){
40495 ** is greater than the current value of Pager.dbSize, then playback is
40523 Pager *pPager, /* The pager being played back */
40548 ** a hot-journal rollback. If it is a hot-journal rollback, the pager
40601 /* If the pager is in CACHEMOD state, then there must be a copy of this
40602 ** page in the pager cache. In this case just update the pager cache,
40607 ** not be in the pager cache. Later: if a malloc() or IO error occurs
40613 ** pager cache if it exists and the main file. The page is then marked
40616 ** if the pager is in OPEN state.
40682 ** and if the pager requires a journal-sync, then mark the page as
40718 ** already in the journal file (recorded in Pager.pInJournal) and
40731 /* If this was page 1, then restore the value of Pager.dbFileVers.
40750 ** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not
40787 static int pager_delmaster(Pager *pPager, const char *zMaster){
40882 ** If the main database file is not open, or the pager is not in either
40897 static int pager_truncate(Pager *pPager, Pgno nPage){
40908 /* TODO: Is it safe to use Pager.dbFileSize here? */
40930 ** Set the value of the Pager.sectorSize variable for the given
40931 ** pager based on the value returned by the xSectorSize method
40952 static void setSectorSize(Pager *pPager){
41028 ** If the journal really is hot, reset the pager cache prior rolling
41032 static int pager_playback(Pager *pPager, int isHot){
41058 ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that
41156 ** code. This will cause the pager to enter the error state
41213 /* The Pager.sectorSize variable may have been updated while rolling
41227 ** If page 1 is read, then the value of Pager.dbFileVers[] is set to
41234 Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
41319 ** is actually a pointer to the Pager structure.
41329 Pager *pPager = (Pager *)pCtx;
41361 static int pagerRollbackWal(Pager *pPager){
41394 Pager *pPager, /* Pager object */
41455 static int pagerBeginReadTransaction(Pager *pPager){
41481 ** in pages (assuming the page size currently stored in Pager.pageSize).
41487 static int pagerPagecount(Pager *pPager, Pgno *pnPage){
41491 ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or
41519 ** configured maximum pager number, increase the allowed limit so
41536 ** If the database is not empty and the *-wal file exists, open the pager
41538 ** if no error occurs, make sure Pager.journalMode is not set to
41549 static int pagerOpenWalIfPresent(Pager *pPager){
41612 ** In either case, before playback commences the Pager.dbSize variable
41617 static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
41728 SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
41733 ** Free as much memory as possible from the pager.
41735 SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){
41784 Pager *pPager, /* The pager to set safety level for */
41837 Pager *pPager, /* The pager object */
41857 ** The pager invokes the busy-handler if sqlite3OsLock() returns
41873 ** returned to the caller of the pager API function.
41876 Pager *pPager, /* Pager object */
41885 ** Change the page size used by the Pager object. The new page size
41888 ** If the pager is in the error state when this function is called, it
41902 ** then the pager object page size is set to *pPageSize.
41905 ** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt
41910 ** conditions above is not true, the pager was in error state when this
41914 SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
41919 ** of the Pager object is internally consistent.
41921 ** At one point this function returned an error if the pager was in
41966 ** by the pager. This is a buffer that is big enough to hold the
41972 SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){
41983 SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
42020 ** If the pager was opened on a transient file (zFilename==""), or
42030 SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){
42036 ** the Pager object. There has not been an opportunity to transition
42053 ** the pager. It returns the total number of pages in the database.
42058 SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){
42076 ** the lock. If the lock is obtained successfully, set the Pager.state
42079 static int pager_wait_on_lock(Pager *pPager, int locktype){
42125 static void assertTruncateConstraint(Pager *pPager){
42135 ** just sets the internal state of the pager object so that the
42138 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
42160 static int pagerSyncHotJournal(Pager *pPager){
42185 SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){
42206 ** If an error occurs while trying to sync the journal, shift the pager
42258 ** If the Pager.noSync flag is set, then this function is a no-op.
42268 ** been written following it. If the pager is operating in full-sync
42288 static int syncJournal(Pager *pPager, int newHdr){
42310 ** than Pager.journalOff bytes. If the next thing in the journal
42321 ** a valid header following Pager.journalOff, then write a 0x00
42389 /* Unless the pager is in noSync mode, the journal file was just
42406 ** The pager must hold at least a RESERVED lock when this function
42411 ** If the pager is a temp-file pager and the actual file-system file
42419 ** * The page number is greater than Pager.dbSize, or
42422 ** If writing out a page causes the database file to grow, Pager.dbFileSize
42424 ** in Pager.dbFileVers[] is updated to match the new value stored in
42431 static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
42462 ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to
42482 /* If page 1 was just written, update Pager.dbFileVers to match
42493 /* Update any backup objects copying the contents of this pager. */
42519 static int openSubJournal(Pager *pPager){
42546 Pager *pPager = pPg->pPager;
42584 ** soft memory limit. The first argument is a pointer to a Pager object
42585 ** (cast as a void*). The pager is always 'purgeable' (not an in-memory
42588 ** is always associated with the Pager object passed as the first
42602 Pager *pPager = (Pager *)p;
42698 ** Allocate and initialize a new Pager object and put a pointer to it
42699 ** in *ppPager. The pager should eventually be freed by passing it
42714 ** operation of the pager. It should be passed some bitwise combination
42720 ** If the pager object is allocated and the specified file opened
42722 ** the new pager object. If an error occurs, *ppPager is set to NULL
42729 Pager **ppPager, /* OUT: Return the Pager structure here */
42737 Pager *pPager = 0; /* Pager object to allocate and return */
42811 /* Allocate memory for the Pager structure, PCache object, the
42815 ** Pager object (sizeof(Pager) bytes)
42824 ROUND8(sizeof(*pPager)) + /* Pager structure */
42839 pPager = (Pager*)(pPtr);
42847 /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */
42867 /* Open the pager file.
42924 ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer.
42933 ** Pager structure and close the file.
43011 ** the file-system for the given pager. A hot journal is one that
43039 static int hasHotJournal(Pager *pPager, int *pExists){
43137 ** 1) If the pager is currently in PAGER_OPEN state (no lock held
43146 ** 2) If the pager is running in exclusive-mode, and there are currently
43156 SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
43160 ** outstanding pages. This implies that the pager state should either
43161 ** be OPEN or READER. READER is only possible if the pager is or was in
43202 ** Unless the pager is in locking_mode=exclusive mode, the lock is
43220 ** may mean that the pager was in the error-state when this
43264 ** the file. If the unlock attempt fails, then Pager.eLock must be
43268 ** In order to get pager_unlock() to do this, set Pager.eState to
43272 ** shortly transition the pager object to the OPEN state. Calling
43358 ** transaction and unlock the pager.
43364 static void pagerUnlockIfUnused(Pager *pPager){
43371 ** Acquire a reference to page number pgno in pager pPager (a page
43403 ** to pgno in Pager.pInJournal (bitvec of pages already written to the
43421 Pager *pPager, /* The pager open on the database file */
43436 /* If the pager is in the error state, return an error immediately.
43446 ** pager was already in the error-state when this function was called.
43462 /* The pager cache has created a new page. Its content needs to
43533 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
43553 Pager *pPager = pPg->pPager;
43564 ** Open the journal file for pager pPager and write a journal header
43575 ** Pager.pInJournal bitvec structure is allocated.
43578 ** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or
43581 static int pager_open_journal(Pager *pPager){
43648 ** Begin a write-transaction on the specified pager object. If a
43664 SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
43675 /* If the pager is configured to use locking_mode=exclusive, and an
43707 ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD
43734 ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs
43739 Pager *pPager = pPg->pPager;
43768 ** an error might occur and the pager would end up in WRITER_LOCKED state
43886 Pager *pPager = pPg->pPager;
43985 ** A call to this routine tells the pager that it is not necessary to
43992 ** on the given page is unused. The pager marks the page as clean so
43999 Pager *pPager = pPg->pPager;
44011 ** byte offset 24 of the pager file. The secondary change counter at
44030 static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
44102 ** or pages with the Pager.noSync flag set.
44104 ** If successful, or if called on a pager for which it is a no-op, this
44107 SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager){
44133 SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
44147 ** Sync the database file for the pager pPager. zMaster points to the name
44173 Pager *pPager, /* Pager object */
44278 ** current value of Pager.dbSize, set dbSize back to the value
44371 ** If an error occurs, an IO error code is returned and the pager
44374 SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){
44389 ** this transaction, the pager is running in exclusive-mode and is
44396 ** header. Since the pager is in exclusive mode, there is no need
44416 ** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR
44419 ** If the pager is already in PAGER_ERROR state when this function is called,
44420 ** it returns Pager.errCode immediately. No work is performed in this case.
44439 SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){
44444 ** the pager is already in the ERROR state, the rollback is not
44460 /* This can happen using journal_mode=off. Move the pager to the error
44476 /* If an error occurs during a ROLLBACK, we can no longer trust the pager
44486 SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){
44491 ** Return the number of references to the pager.
44493 SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){
44499 ** used by the pager and its associated cache.
44501 SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){
44520 SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){
44544 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){
44563 ** Return true if this is an in-memory pager.
44565 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){
44579 SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){
44588 PagerSavepoint *aNew; /* New Pager.aSavepoint array */
44590 /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
44640 ** (the first created). A value of (Pager.nSavepoint-1) means operate
44642 ** (Pager.nSavepoint-1), then this function is a no-op.
44658 SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
44708 SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager *pPager){
44713 ** Return the VFS structure for the pager.
44715 SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){
44721 ** with the pager. This might return NULL if the file has
44724 SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){
44731 SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){
44736 ** Return true if fsync() calls are disabled for this pager. Return FALSE
44739 SQLITE_PRIVATE int sqlite3PagerNosync(Pager *pPager){
44745 ** Set or retrieve the codec for this pager
44748 Pager *pPager,
44761 SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){
44792 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
44892 ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC
44929 ** Return a pointer to the Pager.nExtra bytes of "extra" space
44937 ** Get/set the locking-mode for this pager. Parameter eMode must be one
44946 SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){
44960 ** Set the journal-mode for this pager. Parameter eMode must be one of:
44979 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
45020 ** mode except WAL, unless the pager is in locking_mode=exclusive mode,
45075 SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
45080 ** Return TRUE if the pager is in a state where it is OK to change the
45084 SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
45097 SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
45111 SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){
45117 ** Unless this is an in-memory or temporary database, clear the pager cache.
45119 SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){
45132 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){
45144 SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){
45149 ** Return true if the underlying VFS for the given pager supports the
45152 SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){
45161 static int pagerExclusiveLock(Pager *pPager){
45176 ** Call sqlite3WalOpen() to open the WAL handle. If the pager is in
45181 static int pagerOpenWal(Pager *pPager){
45187 /* If the pager is already in exclusive-mode, the WAL module will use
45214 ** If the pager passed as the first argument is open on a real database
45217 ** return SQLITE_OK. If an error occurs or the VFS used by the pager does
45221 ** If the pager is open on a temp-file (or in-memory database), or if
45226 Pager *pPager, /* Pager object */
45264 SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){
45302 ** A read-lock must be held on the pager when this function is called. If
45303 ** the pager is in WAL mode and the WAL file currently contains one or more
45308 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
45333 /************** End of pager.c ***********************************************/
47591 ** Pager layer will use this to know that is cache is stale and
48304 ** performed, then the pager-cache associated with pWal is now
48306 ** next time the pager opens a snapshot on this database it knows that
48343 ** operation must occur while the pager is still holding the exclusive
48350 ** routine is a no-op. The pager must already hold the exclusive lock
48354 ** not actually change anything. The pager uses this to see if it
48366 ** locks are taken in this case). Nor should the pager attempt to
48731 DbPage *pDbPage; /* Pager page handle */
48843 Pager *pPager; /* The page cache */
49075 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
49428 ** Enable or disable the shared pager and schema features.
49907 ** page from the pager layer with the 'no-content' flag set. True otherwise.
50889 ** Convert a DbPage obtained from the pager into a MemPage used by
50903 ** Get a page from the pager. Initialize the MemPage.pBt and
50930 ** Retrieve a page from the pager cache. If the requested page is not
50931 ** already in the pager cache return NULL. Initialize the MemPage.pBt and
50958 ** Get a page from the pager and initialize it. This routine is just a
51006 ** During a rollback, when the pager reloads information into the cache
51312 /* If the B-Tree was successfully opened, set the pager-cache size to the
51313 ** default value. Except, when opening on an existing shared pager-cache,
51314 ** do not change the pager-cache size.
51447 ** value of mxPage. If mxPage is negative, the pager will
52034 /* This call makes sure that the pager has the correct number of
52173 Pager *pPager = pBt->pPager;
52397 Pager *pPager = pBt->pPager;
52521 ** call below will unlock the pager. */
52531 ** pager if this call closed the only read or write transaction. */
52551 ** Normally, if an error occurs while the pager layer is attempting to
52557 ** functions return code. So, even if an error occurs in the pager layer,
52559 ** transaction has been closed. This is quite safe, as the pager will have
52742 /* At the pager level, a statement transaction is a savepoint with
52804 ** 2: Other database connections that share the same pager cache
56882 ** Return the pager associated with a BTree. This routine is used for
56885 SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){
57395 ** The pager filename is invariant as long as the pager is
57408 ** The pager journal filename is invariant as long as the pager is
57679 int isAttached; /* True once backup has been registered with pager */
57680 sqlite3_backup *pNext; /* Next backup associated with source pager */
57695 ** invoked by the pager layer to report various state changes in
57851 Pager * const pDestPager = sqlite3BtreePager(p->pDest);
57913 ** and the pager code use this trick (clearing the first byte
57945 ** Register this backup object with the associated source pager for
57974 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
57975 Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */
57980 /* If the source pager is currently in a write-transaction, return
58016 ** source pager for the number of pages in the database.
58192 /* Detach this backup from the source pager. */
58260 ** has been modified by a transaction on the source pager. Copy
58277 ** Restart the backup process. This is called when the pager layer
61669 ** pagerStress() in pager.c), the rollback is required to restore
61670 ** the pager to a consistent state.
65357 Pager *pPager; /* Pager associated with pBt */
67803 ** P3==3 is the recommended pager cache size, and so forth. P1==0 is
67834 ** P2==2 is the database format. P2==3 is the recommended pager cache
70435 Pager *pPager; /* Pager associated with pBt */
80534 Pager *pPager;
92329 ** defined in pager.h. This function returns the associated lowercase
92512 ** buffer that the pager module resizes using sqlite3_realloc().
92596 Pager *pPager;
92685 Pager *pPager = sqlite3BtreePager(pDb->pBt);
92888 Pager *pPager = sqlite3BtreePager(pDb->pBt);
92902 Pager *pPager = sqlite3BtreePager(pDb->pBt);
93559 Pager *pPager;
101252 ** An optimisation would be to use a non-journaled pager.
101443 ** vacuum database. The vacuum_db journal file is deleted when the pager
112984 Pager *pPager = sqlite3BtreePager(pBt);
113129 ** at the b-tree/pager level.
113976 ** a temporary file for transient pager files and statement journals.
114674 ** database it is 'NONE'. This matches the pager layer defaults.
115148 Pager *pPager;
120872 ** of the number of overflow pages that will be loaded by the pager layer