Lines Matching defs: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);
28626 /* The pager calls this method to signal that it has done
37839 ** held by the pager system. Memory in use by any SQLite pager allocated
38316 pager.c *******************************************/
38328 ** This is the implementation of the page cache subsystem or "pager".
38330 ** The pager is used to access a database disk file. It implements
38332 ** is separate from the database file. The pager also implements file
38338 /************** Include wal.h in the middle of pager.c ***********************/
38390 ** There is one object of this type for each pager.
38456 ** by the pager layer on the database file.
38477 /************** Continuing where we left off in pager.c **********************/
38480 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
38581 ** PAGERID() takes a pointer to a Pager struct as its argument. The
38589 ** The Pager.eState variable stores the current 'state' of a pager. A
38590 ** pager may be in any one of the seven states shown in the following
38628 ** The pager starts up in this state. Nothing is guaranteed in this
38639 ** rollback (non-WAL) mode are met. Unless the pager is (or recently
38662 ** The pager moves to this state from READER when a write-transaction
38685 ** * The contents of the pager cache have not been modified.
38691 ** A pager moves from WRITER_LOCKED state to this state when a page is
38704 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
38720 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
38738 ** difficult to be sure that the in-memory pager state (cache contents,
38741 ** Temporary pager files may enter the ERROR state, but in-memory pagers
38750 ** file. To avoid this hazard, the pager switches into the ERROR state
38753 ** Once it has entered the ERROR state, any attempt to use the pager
38755 ** outstanding transactions have been abandoned, the pager is able to
38759 ** when a read-transaction is next opened on the pager (transitioning
38760 ** the pager into READER state). At that point the system has recovered
38763 ** Specifically, the pager jumps into the ERROR state if:
38777 ** persists, the pager enters the ERROR state via condition (1) above.
38783 ** read-only statement cannot leave the pager in an internally inconsistent
38786 ** * The Pager.errCode variable is set to something other than SQLITE_OK.
38788 ** last reference is dropped the pager should move back to OPEN state).
38789 ** * The pager is not an in-memory pager.
38794 ** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the
38801 ** executed), and when the pager is leaving the "error state".
38814 ** The Pager.eLock variable is almost always set to one of the
38825 ** VFS call is successful. This way, the Pager.eLock variable may be set
38833 ** The exception is when the database file is unlocked as the pager moves
38836 ** transition, by the same pager or any other). If the call to xUnlock()
38837 ** fails at this point and the pager is left holding an EXCLUSIVE lock, this
38850 ** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It
38853 ** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK
38858 ** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in
38888 ** are stored in the Pager.aSavepoint[] array, which is allocated and
38911 ** A open page cache is an instance of struct Pager. A description of
38916 ** The current 'state' of the pager object. See the comment and state
38917 ** diagram above for a description of the pager state.
38926 ** databases always have Pager.exclusiveMode==1, this tricks the pager
38974 ** is cleared anyway (and the pager will move to ERROR state).
38998 ** sub-journals are only used for in-memory pager files.
39037 ** that the database file is larger than the database image (Pager.dbSize),
39059 ** The Pager.errCode variable is only ever used in PAGER_ERROR state. It
39060 ** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode
39064 struct Pager {
39081 ** when the pager is first created or else only change when there is a
39084 ** the "state" of the pager, while other class members describe the
39085 ** "configuration" of the pager.
39087 u8 eState; /* Pager state (OPEN, READER, WRITER_LOCKED..) */
39138 char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */
39196 ** The journal header size for this pager. This is usually the same
39233 ** Return true if this pager uses a write-ahead log instead of the usual
39237 static int pagerUseWal(Pager *pPager){
39255 ** the internal state of the Pager object.
39257 static int assert_pager_state(Pager *p){
39258 Pager *pPager = p;
39284 ** this means an in-memory pager performs no IO at all, it cannot encounter
39288 ** is therefore not possible for an in-memory pager to enter the ERROR
39373 /* There must be at least one outstanding reference to the pager if
39374 ** in ERROR state. Otherwise the pager should have already dropped
39389 ** containing the state of the Pager object passed as an argument. This
39395 static char *print_pager_state(Pager *p){
39448 Pager *pPager = pPg->pPager;
39501 ** succeeds, set the Pager.eLock variable to match the (attempted) new lock.
39503 ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
39507 static int pagerUnlockDb(Pager *pPager, int eLock){
39527 ** Pager.eLock variable to the new locking state.
39529 ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
39534 static int pagerLockDb(Pager *pPager, int eLock){
39550 ** can be used with this pager. The optimization can be used if:
39566 static int jrnlBufferSize(Pager *pPager){
39620 Pager *pPager = pPg->pPager;
39633 ** When this is called the journal file for pager pPager must be open.
39702 ** Pager.journalOff Return value
39710 static i64 journalHdrOffset(Pager *pPager){
39726 ** within the current transaction (i.e. if Pager.journalOff==0).
39728 ** If doTruncate is non-zero or the Pager.journalSizeLimit variable is
39731 ** if the pager is not in no-sync mode, sync the journal file immediately
39734 ** If Pager.journalSizeLimit is set to a positive, non-zero value, and
39737 ** journal file to Pager.journalSizeLimit bytes. The journal file does
39743 static int zeroJournalHdr(Pager *pPager, int doTruncate){
39792 static int writeJournalHdr(Pager *pPager){
39831 ** * When the pager is in no-sync mode. Corruption can follow a
39868 ** Pager
39879 ** database page size. Since the zHeader buffer is only Pager.pageSize
39911 Pager *pPager, /* Pager object */
39923 /* Advance Pager.journalOff to the start of the next sector. If the
39971 ** journal header to zero. In this case, assume that the Pager.pageSize
40006 ** of Pager.sectorSize is restored at the end of that routine.
40017 ** Write the supplied master journal name into the journal file for pager
40019 ** thing written to a journal file. If the pager is in full-sync mode, the
40035 static int writeMasterJournal(Pager *pPager, const char *zMaster){
40082 /* If the pager is in peristent-journal mode, then the physical
40105 static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
40118 static void pager_reset(Pager *pPager){
40124 ** Free all structures in the Pager.aSavepoint[] array and set both
40125 ** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal
40126 ** if it is open and the pager is not in exclusive mode.
40128 static void releaseAllSavepoints(Pager *pPager){
40129 int ii; /* Iterator for looping through Pager.aSavepoint */
40147 static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
40163 ** This function is a no-op if the pager is in exclusive mode and not
40164 ** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN
40167 ** If the pager is not in exclusive-access mode, the database file is
40172 ** If the pager is in ERROR state when this function is called, the
40173 ** contents of the pager cache are discarded before switching back to
40174 ** the OPEN state. Regardless of whether the pager is in exclusive-mode
40179 static void pager_unlock(Pager *pPager){
40215 /* If the pager is in the ERROR state and the call to unlock the database
40225 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
40234 /* If Pager.errCode is set, the contents of the pager cache cannot be
40235 ** trusted. Now that there are no outstanding references to the pager,
40254 ** the pager to transition into the ERROR state may ahve occurred.
40255 ** The first argument is a pointer to the pager structure, the second
40256 ** the error-code about to be returned by a pager API function. The
40260 ** IOERR sub-codes, the pager enters the ERROR state and the error code
40261 ** is stored in Pager.errCode. While the pager remains in the ERROR state,
40262 ** all major API calls on the Pager will immediately return Pager.errCode.
40264 ** The ERROR state indicates that the contents of the pager-cache
40266 ** the contents of the pager-cache. If a transaction was active when
40271 static int pager_error(Pager *pPager, int rc){
40303 ** depends on whether or not the pager is running in exclusive mode and
40304 ** the current journal-mode (Pager.journalMode value), as follows:
40321 ** If the pager is running in exclusive mode, this method of finalizing
40323 ** DELETE and the pager is in exclusive mode, the method described under
40326 ** After the journal is finalized, the pager moves to PAGER_READER state.
40339 static int pager_end_transaction(Pager *pPager, int hasMaster){
40343 /* Do nothing if the pager does not have an open write transaction
40384 /* This branch may be executed with Pager.journalMode==MEMORY if
40441 ** If the pager has already entered the ERROR state, do not attempt
40444 ** the database file and move the pager back to OPEN state. If this
40446 ** connection to obtain a shared lock on the pager (which may be this one)
40449 ** If the pager has not already entered the ERROR state, but an IO or
40451 ** the pager to enter the ERROR state. Which will be cleared by the
40454 static void pagerUnlockAndRollback(Pager *pPager){
40488 static u32 pager_cksum(Pager *pPager, const u8 *aData){
40503 static void pagerReportSize(Pager *pPager){
40523 ** is greater than the current value of Pager.dbSize, then playback is
40551 Pager *pPager, /* The pager being played back */
40576 ** a hot-journal rollback. If it is a hot-journal rollback, the pager
40629 /* If the pager is in CACHEMOD state, then there must be a copy of this
40630 ** page in the pager cache. In this case just update the pager cache,
40635 ** not be in the pager cache. Later: if a malloc() or IO error occurs
40641 ** pager cache if it exists and the main file. The page is then marked
40644 ** if the pager is in OPEN state.
40710 ** and if the pager requires a journal-sync, then mark the page as
40746 ** already in the journal file (recorded in Pager.pInJournal) and
40759 /* If this was page 1, then restore the value of Pager.dbFileVers.
40778 ** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not
40815 static int pager_delmaster(Pager *pPager, const char *zMaster){
40910 ** If the main database file is not open, or the pager is not in either
40925 static int pager_truncate(Pager *pPager, Pgno nPage){
40936 /* TODO: Is it safe to use Pager.dbFileSize here? */
40958 ** Set the value of the Pager.sectorSize variable for the given
40959 ** pager based on the value returned by the xSectorSize method
40980 static void setSectorSize(Pager *pPager){
41056 ** If the journal really is hot, reset the pager cache prior rolling
41060 static int pager_playback(Pager *pPager, int isHot){
41086 ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that
41184 ** code. This will cause the pager to enter the error state
41241 /* The Pager.sectorSize variable may have been updated while rolling
41255 ** If page 1 is read, then the value of Pager.dbFileVers[] is set to
41262 Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
41347 ** is actually a pointer to the Pager structure.
41357 Pager *pPager = (Pager *)pCtx;
41389 static int pagerRollbackWal(Pager *pPager){
41422 Pager *pPager, /* Pager object */
41483 static int pagerBeginReadTransaction(Pager *pPager){
41509 ** in pages (assuming the page size currently stored in Pager.pageSize).
41515 static int pagerPagecount(Pager *pPager, Pgno *pnPage){
41519 ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or
41547 ** configured maximum pager number, increase the allowed limit so
41564 ** If the database is not empty and the *-wal file exists, open the pager
41566 ** if no error occurs, make sure Pager.journalMode is not set to
41577 static int pagerOpenWalIfPresent(Pager *pPager){
41640 ** In either case, before playback commences the Pager.dbSize variable
41645 static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
41756 SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
41761 ** Free as much memory as possible from the pager.
41763 SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){
41812 Pager *pPager, /* The pager to set safety level for */
41865 Pager *pPager, /* The pager object */
41885 ** The pager invokes the busy-handler if sqlite3OsLock() returns
41901 ** returned to the caller of the pager API function.
41904 Pager *pPager, /* Pager object */
41913 ** Change the page size used by the Pager object. The new page size
41916 ** If the pager is in the error state when this function is called, it
41930 ** then the pager object page size is set to *pPageSize.
41933 ** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt
41938 ** conditions above is not true, the pager was in error state when this
41942 SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
41947 ** of the Pager object is internally consistent.
41949 ** At one point this function returned an error if the pager was in
41994 ** by the pager. This is a buffer that is big enough to hold the
42000 SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){
42011 SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
42048 ** If the pager was opened on a transient file (zFilename==""), or
42058 SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){
42064 ** the Pager object. There has not been an opportunity to transition
42081 ** the pager. It returns the total number of pages in the database.
42086 SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){
42104 ** the lock. If the lock is obtained successfully, set the Pager.state
42107 static int pager_wait_on_lock(Pager *pPager, int locktype){
42153 static void assertTruncateConstraint(Pager *pPager){
42163 ** just sets the internal state of the pager object so that the
42166 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
42188 static int pagerSyncHotJournal(Pager *pPager){
42213 SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){
42234 ** If an error occurs while trying to sync the journal, shift the pager
42286 ** If the Pager.noSync flag is set, then this function is a no-op.
42296 ** been written following it. If the pager is operating in full-sync
42316 static int syncJournal(Pager *pPager, int newHdr){
42338 ** than Pager.journalOff bytes. If the next thing in the journal
42349 ** a valid header following Pager.journalOff, then write a 0x00
42417 /* Unless the pager is in noSync mode, the journal file was just
42434 ** The pager must hold at least a RESERVED lock when this function
42439 ** If the pager is a temp-file pager and the actual file-system file
42447 ** * The page number is greater than Pager.dbSize, or
42450 ** If writing out a page causes the database file to grow, Pager.dbFileSize
42452 ** in Pager.dbFileVers[] is updated to match the new value stored in
42459 static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
42490 ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to
42510 /* If page 1 was just written, update Pager.dbFileVers to match
42521 /* Update any backup objects copying the contents of this pager. */
42547 static int openSubJournal(Pager *pPager){
42574 Pager *pPager = pPg->pPager;
42612 ** soft memory limit. The first argument is a pointer to a Pager object
42613 ** (cast as a void*). The pager is always 'purgeable' (not an in-memory
42616 ** is always associated with the Pager object passed as the first
42630 Pager *pPager = (Pager *)p;
42726 ** Allocate and initialize a new Pager object and put a pointer to it
42727 ** in *ppPager. The pager should eventually be freed by passing it
42742 ** operation of the pager. It should be passed some bitwise combination
42748 ** If the pager object is allocated and the specified file opened
42750 ** the new pager object. If an error occurs, *ppPager is set to NULL
42757 Pager **ppPager, /* OUT: Return the Pager structure here */
42765 Pager *pPager = 0; /* Pager object to allocate and return */
42839 /* Allocate memory for the Pager structure, PCache object, the
42843 ** Pager object (sizeof(Pager) bytes)
42852 ROUND8(sizeof(*pPager)) + /* Pager structure */
42867 pPager = (Pager*)(pPtr);
42875 /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */
42895 /* Open the pager file.
42952 ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer.
42961 ** Pager structure and close the file.
43039 ** the file-system for the given pager. A hot journal is one that
43067 static int hasHotJournal(Pager *pPager, int *pExists){
43165 ** 1) If the pager is currently in PAGER_OPEN state (no lock held
43174 ** 2) If the pager is running in exclusive-mode, and there are currently
43184 SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
43188 ** outstanding pages. This implies that the pager state should either
43189 ** be OPEN or READER. READER is only possible if the pager is or was in
43230 ** Unless the pager is in locking_mode=exclusive mode, the lock is
43248 ** may mean that the pager was in the error-state when this
43292 ** the file. If the unlock attempt fails, then Pager.eLock must be
43296 ** In order to get pager_unlock() to do this, set Pager.eState to
43300 ** shortly transition the pager object to the OPEN state. Calling
43386 ** transaction and unlock the pager.
43392 static void pagerUnlockIfUnused(Pager *pPager){
43399 ** Acquire a reference to page number pgno in pager pPager (a page
43431 ** to pgno in Pager.pInJournal (bitvec of pages already written to the
43449 Pager *pPager, /* The pager open on the database file */
43464 /* If the pager is in the error state, return an error immediately.
43474 ** pager was already in the error-state when this function was called.
43490 /* The pager cache has created a new page. Its content needs to
43561 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
43581 Pager *pPager = pPg->pPager;
43592 ** Open the journal file for pager pPager and write a journal header
43603 ** Pager.pInJournal bitvec structure is allocated.
43606 ** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or
43609 static int pager_open_journal(Pager *pPager){
43676 ** Begin a write-transaction on the specified pager object. If a
43692 SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
43703 /* If the pager is configured to use locking_mode=exclusive, and an
43735 ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD
43762 ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs
43767 Pager *pPager = pPg->pPager;
43796 ** an error might occur and the pager would end up in WRITER_LOCKED state
43914 Pager *pPager = pPg->pPager;
44013 ** A call to this routine tells the pager that it is not necessary to
44020 ** on the given page is unused. The pager marks the page as clean so
44027 Pager *pPager = pPg->pPager;
44039 ** byte offset 24 of the pager file. The secondary change counter at
44058 static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
44130 ** or pages with the Pager.noSync flag set.
44132 ** If successful, or if called on a pager for which it is a no-op, this
44135 SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager){
44161 SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
44175 ** Sync the database file for the pager pPager. zMaster points to the name
44201 Pager *pPager, /* Pager object */
44306 ** current value of Pager.dbSize, set dbSize back to the value
44399 ** If an error occurs, an IO error code is returned and the pager
44402 SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){
44417 ** this transaction, the pager is running in exclusive-mode and is
44424 ** header. Since the pager is in exclusive mode, there is no need
44444 ** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR
44447 ** If the pager is already in PAGER_ERROR state when this function is called,
44448 ** it returns Pager.errCode immediately. No work is performed in this case.
44467 SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){
44472 ** the pager is already in the ERROR state, the rollback is not
44488 /* This can happen using journal_mode=off. Move the pager to the error
44504 /* If an error occurs during a ROLLBACK, we can no longer trust the pager
44514 SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){
44519 ** Return the number of references to the pager.
44521 SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){
44527 ** used by the pager and its associated cache.
44529 SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){
44548 SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){
44572 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){
44591 ** Return true if this is an in-memory pager.
44593 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){
44607 SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){
44616 PagerSavepoint *aNew; /* New Pager.aSavepoint array */
44618 /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
44668 ** (the first created). A value of (Pager.nSavepoint-1) means operate
44670 ** (Pager.nSavepoint-1), then this function is a no-op.
44686 SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
44736 SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager *pPager){
44741 ** Return the VFS structure for the pager.
44743 SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){
44749 ** with the pager. This might return NULL if the file has
44752 SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){
44759 SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){
44764 ** Return true if fsync() calls are disabled for this pager. Return FALSE
44767 SQLITE_PRIVATE int sqlite3PagerNosync(Pager *pPager){
44773 ** Set or retrieve the codec for this pager
44776 Pager *pPager,
44789 SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){
44820 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
44920 ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC
44957 ** Return a pointer to the Pager.nExtra bytes of "extra" space
44965 ** Get/set the locking-mode for this pager. Parameter eMode must be one
44974 SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){
44988 ** Set the journal-mode for this pager. Parameter eMode must be one of:
45007 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
45048 ** mode except WAL, unless the pager is in locking_mode=exclusive mode,
45103 SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
45108 ** Return TRUE if the pager is in a state where it is OK to change the
45112 SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
45125 SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
45139 SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){
45145 ** Unless this is an in-memory or temporary database, clear the pager cache.
45147 SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){
45160 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){
45172 SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){
45177 ** Return true if the underlying VFS for the given pager supports the
45180 SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){
45189 static int pagerExclusiveLock(Pager *pPager){
45204 ** Call sqlite3WalOpen() to open the WAL handle. If the pager is in
45209 static int pagerOpenWal(Pager *pPager){
45215 /* If the pager is already in exclusive-mode, the WAL module will use
45242 ** If the pager passed as the first argument is open on a real database
45245 ** return SQLITE_OK. If an error occurs or the VFS used by the pager does
45249 ** If the pager is open on a temp-file (or in-memory database), or if
45254 Pager *pPager, /* Pager object */
45292 SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){
45330 ** A read-lock must be held on the pager when this function is called. If
45331 ** the pager is in WAL mode and the WAL file currently contains one or more
45336 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
45361 /************** End of pager.c ***********************************************/
47619 ** Pager layer will use this to know that is cache is stale and
48332 ** performed, then the pager-cache associated with pWal is now
48334 ** next time the pager opens a snapshot on this database it knows that
48371 ** operation must occur while the pager is still holding the exclusive
48378 ** routine is a no-op. The pager must already hold the exclusive lock
48382 ** not actually change anything. The pager uses this to see if it
48394 ** locks are taken in this case). Nor should the pager attempt to
48759 DbPage *pDbPage; /* Pager page handle */
48871 Pager *pPager; /* The page cache */
49103 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
49456 ** Enable or disable the shared pager and schema features.
49935 ** page from the pager layer with the 'no-content' flag set. True otherwise.
50917 ** Convert a DbPage obtained from the pager into a MemPage used by
50931 ** Get a page from the pager. Initialize the MemPage.pBt and
50958 ** Retrieve a page from the pager cache. If the requested page is not
50959 ** already in the pager cache return NULL. Initialize the MemPage.pBt and
50986 ** Get a page from the pager and initialize it. This routine is just a
51034 ** During a rollback, when the pager reloads information into the cache
51340 /* If the B-Tree was successfully opened, set the pager-cache size to the
51341 ** default value. Except, when opening on an existing shared pager-cache,
51342 ** do not change the pager-cache size.
51475 ** value of mxPage. If mxPage is negative, the pager will
52062 /* This call makes sure that the pager has the correct number of
52201 Pager *pPager = pBt->pPager;
52425 Pager *pPager = pBt->pPager;
52549 ** call below will unlock the pager. */
52559 ** pager if this call closed the only read or write transaction. */
52579 ** Normally, if an error occurs while the pager layer is attempting to
52585 ** functions return code. So, even if an error occurs in the pager layer,
52587 ** transaction has been closed. This is quite safe, as the pager will have
52770 /* At the pager level, a statement transaction is a savepoint with
52832 ** 2: Other database connections that share the same pager cache
56910 ** Return the pager associated with a BTree. This routine is used for
56913 SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){
57423 ** The pager filename is invariant as long as the pager is
57436 ** The pager journal filename is invariant as long as the pager is
57707 int isAttached; /* True once backup has been registered with pager */
57708 sqlite3_backup *pNext; /* Next backup associated with source pager */
57723 ** invoked by the pager layer to report various state changes in
57879 Pager * const pDestPager = sqlite3BtreePager(p->pDest);
57941 ** and the pager code use this trick (clearing the first byte
57973 ** Register this backup object with the associated source pager for
58002 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
58003 Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */
58008 /* If the source pager is currently in a write-transaction, return
58044 ** source pager for the number of pages in the database.
58220 /* Detach this backup from the source pager. */
58288 ** has been modified by a transaction on the source pager. Copy
58305 ** Restart the backup process. This is called when the pager layer
61697 ** pagerStress() in pager.c), the rollback is required to restore
61698 ** the pager to a consistent state.
65385 Pager *pPager; /* Pager associated with pBt */
67831 ** P3==3 is the recommended pager cache size, and so forth. P1==0 is
67862 ** P2==2 is the database format. P2==3 is the recommended pager cache
70463 Pager *pPager; /* Pager associated with pBt */
80570 Pager *pPager;
92365 ** defined in pager.h. This function returns the associated lowercase
92548 ** buffer that the pager module resizes using sqlite3_realloc().
92632 Pager *pPager;
92721 Pager *pPager = sqlite3BtreePager(pDb->pBt);
92924 Pager *pPager = sqlite3BtreePager(pDb->pBt);
92938 Pager *pPager = sqlite3BtreePager(pDb->pBt);
93595 Pager *pPager;
101288 ** An optimisation would be to use a non-journaled pager.
101479 ** vacuum database. The vacuum_db journal file is deleted when the pager
113020 Pager *pPager = sqlite3BtreePager(pBt);
113165 ** at the b-tree/pager level.
114012 ** a temporary file for transient pager files and statement journals.
114710 ** database it is 'NONE'. This matches the pager layer defaults.
115184 Pager *pPager;
120920 ** of the number of overflow pages that will be loaded by the pager layer