Lines Matching refs:Pager
5402 ** CAPI3REF: Enable Or Disable Shared Pager Cache
6872 ** memory used by all pager caches associated with the database connection.)^
6892 ** <dd>This parameter returns the number of pager cache hits that have
6898 ** <dd>This parameter returns the number of pager cache misses that have
9840 ** callback for the database handle. Each pager opened via the sqlite
9842 ** callback is currently invoked only from within pager.c.
10048 ** pager.h.
10128 ** It is a read-only number computed by the pager. But we merge it with
10196 SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
10773 /************** Include pager.h in the middle of sqliteInt.h *****************/
10774 /************** Begin file pager.h *******************************************/
10810 ** Each open file is managed by a separate instance of the "Pager" structure.
10812 typedef struct Pager Pager;
10824 ** roll back. See comments for function writeMasterJournal() in pager.c
10875 ** that make up the Pager sub-system API. See source code comments for
10879 /* Open and close a Pager connection. */
10882 Pager **ppPager,
10889 SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager);
10890 SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
10892 /* Functions used to configure a Pager object. */
10893 SQLITE_PRIVATE void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);
10894 SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int);
10896 SQLITE_PRIVATE void sqlite3PagerAlignReserve(Pager*,Pager*);
10898 SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int);
10899 SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int);
10900 SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64);
10901 SQLITE_PRIVATE void sqlite3PagerShrink(Pager*);
10902 SQLITE_PRIVATE void sqlite3PagerSetFlags(Pager*,unsigned);
10903 SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int);
10904 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int);
10905 SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*);
10906 SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*);
10907 SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
10908 SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*);
10911 SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
10913 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
10921 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
10926 /* Functions used to manage pager transactions and savepoints. */
10927 SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*);
10928 SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int);
10929 SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int);
10930 SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*);
10931 SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster);
10932 SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*);
10933 SQLITE_PRIVATE int sqlite3PagerRollback(Pager*);
10934 SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n);
10935 SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
10936 SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager);
10939 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int*);
10940 SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager);
10941 SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager);
10942 SQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);
10943 SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager);
10947 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager);
10950 /* Functions used to query pager state and configuration. */
10951 SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*);
10952 SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager*);
10954 SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*);
10956 SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*);
10957 SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager*, int);
10958 SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager*);
10959 SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*);
10960 SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*);
10961 SQLITE_PRIVATE int sqlite3PagerNosync(Pager*);
10962 SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*);
10963 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*);
10964 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *);
10965 SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *);
10969 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
10983 SQLITE_PRIVATE int *sqlite3PagerStats(Pager*);
10984 SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*);
10994 /************** End of pager.h ***********************************************/
11027 Pager *pPager; /* The pager this page is part of */
11064 /* Create a new pager cache.
11135 /* Set and get the suggested cache-size for the specified pager-cache.
11138 ** the total number of pages cached by purgeable pager-caches to the sum
11362 ** actual data in the bytes used for locking. The pager never allocates
11810 #define SQLITE_CacheSpill 0x00000010 /* OK to spill pager cache */
15963 Pager *pPager = sqlite3BtreePager(pBt);
16053 Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);
30501 /* The pager calls this method to signal that it has done
41188 ** The pcache.c and pager.c modules deal pointers to PgHdr objects.
42317 ** held by the pager system. Memory in use by any SQLite pager allocated
42885 /************** Begin file pager.c *******************************************/
42897 ** This is the implementation of the page cache subsystem or "pager".
42899 ** The pager is used to access a database disk file. It implements
42901 ** is separate from the database file. The pager also implements file
42908 /************** Include wal.h in the middle of pager.c ***********************/
42961 ** There is one object of this type for each pager.
43028 ** by the pager layer on the database file.
43049 /************** Continuing where we left off in pager.c **********************/
43052 /******************* NOTES ON THE DESIGN OF THE PAGER ************************
43153 ** PAGERID() takes a pointer to a Pager struct as its argument. The
43161 ** The Pager.eState variable stores the current 'state' of a pager. A
43162 ** pager may be in any one of the seven states shown in the following
43200 ** The pager starts up in this state. Nothing is guaranteed in this
43211 ** rollback (non-WAL) mode are met. Unless the pager is (or recently
43234 ** The pager moves to this state from READER when a write-transaction
43257 ** * The contents of the pager cache have not been modified.
43263 ** A pager moves from WRITER_LOCKED state to this state when a page is
43276 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
43292 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
43310 ** difficult to be sure that the in-memory pager state (cache contents,
43313 ** Temporary pager files may enter the ERROR state, but in-memory pagers
43322 ** file. To avoid this hazard, the pager switches into the ERROR state
43325 ** Once it has entered the ERROR state, any attempt to use the pager
43327 ** outstanding transactions have been abandoned, the pager is able to
43331 ** when a read-transaction is next opened on the pager (transitioning
43332 ** the pager into READER state). At that point the system has recovered
43335 ** Specifically, the pager jumps into the ERROR state if:
43349 ** persists, the pager enters the ERROR state via condition (1) above.
43355 ** read-only statement cannot leave the pager in an internally inconsistent
43358 ** * The Pager.errCode variable is set to something other than SQLITE_OK.
43360 ** last reference is dropped the pager should move back to OPEN state).
43361 ** * The pager is not an in-memory pager.
43366 ** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the
43373 ** executed), and when the pager is leaving the "error state".
43386 ** The Pager.eLock variable is almost always set to one of the
43397 ** VFS call is successful. This way, the Pager.eLock variable may be set
43405 ** The exception is when the database file is unlocked as the pager moves
43408 ** transition, by the same pager or any other). If the call to xUnlock()
43409 ** fails at this point and the pager is left holding an EXCLUSIVE lock, this
43422 ** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It
43425 ** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK
43430 ** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in
43460 ** are stored in the Pager.aSavepoint[] array, which is allocated and
43483 ** Bits of the Pager.doNotSpill flag. See further description below.
43490 ** An open page cache is an instance of struct Pager. A description of
43495 ** The current 'state' of the pager object. See the comment and state
43496 ** diagram above for a description of the pager state.
43505 ** databases always have Pager.exclusiveMode==1, this tricks the pager
43553 ** is cleared anyway (and the pager will move to ERROR state).
43579 ** sub-journals are only used for in-memory pager files.
43618 Pager.dbSize),
43640 ** The Pager.errCode variable is only ever used in PAGER_ERROR state. It
43641 ** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode
43645 struct Pager {
43663 ** when the pager is first created or else only change when there is a
43666 ** the "state" of the pager, while other class members describe the
43667 ** "configuration" of the pager.
43669 u8 eState; /* Pager state (OPEN, READER, WRITER_LOCKED..) */
43726 char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */
43735 ** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains
43793 ** The journal header size for this pager. This is usually the same
43840 ** Return true if this pager uses a write-ahead log instead of the usual
43844 static int pagerUseWal(Pager *pPager){
43862 ** the internal state of the Pager object.
43864 static int assert_pager_state(Pager *p){
43865 Pager *pPager = p;
43891 ** this means an in-memory pager performs no IO at all, it cannot encounter
43895 ** is therefore not possible for an in-memory pager to enter the ERROR
43980 /* There must be at least one outstanding reference to the pager if
43981 ** in ERROR state. Otherwise the pager should have already dropped
43996 ** containing the state of the Pager object passed as an argument. This
44002 static char *print_pager_state(Pager *p){
44054 Pager *pPager = pPg->pPager;
44071 static int pageInJournal(Pager *pPager, PgHdr *pPg){
44111 ** succeeds, set the Pager.eLock variable to match the (attempted) new lock.
44113 ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
44117 static int pagerUnlockDb(Pager *pPager, int eLock){
44137 ** Pager.eLock variable to the new locking state.
44139 ** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is
44144 static int pagerLockDb(Pager *pPager, int eLock){
44160 ** can be used with this pager. The optimization can be used if:
44176 static int jrnlBufferSize(Pager *pPager){
44230 Pager *pPager = pPg->pPager;
44243 ** When this is called the journal file for pager pPager must be open.
44313 ** Pager.journalOff Return value
44321 static i64 journalHdrOffset(Pager *pPager){
44337 ** within the current transaction (i.e. if Pager.journalOff==0).
44339 ** If doTruncate is non-zero or the Pager.journalSizeLimit variable is
44342 ** if the pager is not in no-sync mode, sync the journal file immediately
44345 ** If Pager.journalSizeLimit is set to a positive, non-zero value, and
44348 ** journal file to Pager.journalSizeLimit bytes. The journal file does
44354 static int zeroJournalHdr(Pager *pPager, int doTruncate){
44403 static int writeJournalHdr(Pager *pPager){
44442 ** * When the pager is in no-sync mode. Corruption can follow a
44479 ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next
44490 ** database page size. Since the zHeader buffer is only Pager.pageSize
44522 Pager *pPager, /* Pager object */
44534 /* Advance Pager.journalOff to the start of the next sector. If the
44582 ** journal header to zero. In this case, assume that the Pager.pageSize
44617 ** of Pager.sectorSize is restored at the end of that routine.
44628 ** Write the supplied master journal name into the journal file for pager
44630 ** thing written to a journal file. If the pager is in full-sync mode, the
44646 static int writeMasterJournal(Pager *pPager, const char *zMaster){
44693 /* If the pager is in peristent-journal mode, then the physical
44714 static void pager_reset(Pager *pPager){
44723 SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){
44729 ** Free all structures in the Pager.aSavepoint[] array and set both
44730 ** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal
44731 ** if it is open and the pager is not in exclusive mode.
44733 static void releaseAllSavepoints(Pager *pPager){
44734 int ii; /* Iterator for looping through Pager.aSavepoint */
44752 static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
44768 ** This function is a no-op if the pager is in exclusive mode and not
44769 ** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN
44772 ** If the pager is not in exclusive-access mode, the database file is
44777 ** If the pager is in ERROR state when this function is called, the
44778 ** contents of the pager cache are discarded before switching back to
44779 ** the OPEN state. Regardless of whether the pager is in exclusive-mode
44784 static void pager_unlock(Pager *pPager){
44820 /* If the pager is in the ERROR state and the call to unlock the database
44830 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
44839 /* If Pager.errCode is set, the contents of the pager cache cannot be
44840 ** trusted. Now that there are no outstanding references to the pager,
44860 ** the pager to transition into the ERROR state may ahve occurred.
44861 ** The first argument is a pointer to the pager structure, the second
44862 ** the error-code about to be returned by a pager API function. The
44866 ** IOERR sub-codes, the pager enters the ERROR state and the error code
44867 ** is stored in Pager.errCode. While the pager remains in the ERROR state,
44868 ** all major API calls on the Pager will immediately return Pager.errCode.
44870 ** The ERROR state indicates that the contents of the pager-cache
44872 ** the contents of the pager-cache. If a transaction was active when
44877 static int pager_error(Pager *pPager, int rc){
44892 static int pager_truncate(Pager *pPager, Pgno nPage);
44911 ** depends on whether or not the pager is running in exclusive mode and
44912 ** the current journal-mode (Pager.journalMode value), as follows:
44929 ** If the pager is running in exclusive mode, this method of finalizing
44931 ** DELETE and the pager is in exclusive mode, the method described under
44934 ** After the journal is finalized, the pager moves to PAGER_READER state.
44947 static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){
44951 /* Do nothing if the pager does not have an open write transaction
45000 /* This branch may be executed with Pager.journalMode==MEMORY if
45073 ** If the pager has already entered the ERROR state, do not attempt
45076 ** the database file and move the pager back to OPEN state. If this
45078 ** connection to obtain a shared lock on the pager (which may be this one)
45081 ** If the pager has not already entered the ERROR state, but an IO or
45083 ** the pager to enter the ERROR state. Which will be cleared by the
45086 static void pagerUnlockAndRollback(Pager *pPager){
45120 static u32 pager_cksum(Pager *pPager, const u8 *aData){
45135 static void pagerReportSize(Pager *pPager){
45148 ** pager as it is in the source. This comes up when a VACUUM changes the
45151 SQLITE_PRIVATE void sqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){
45169 ** is greater than the current value of Pager.dbSize, then playback is
45197 Pager *pPager, /* The pager being played back */
45222 ** a hot-journal rollback. If it is a hot-journal rollback, the pager
45275 /* If the pager is in CACHEMOD state, then there must be a copy of this
45276 ** page in the pager cache. In this case just update the pager cache,
45281 ** not be in the pager
45287 ** pager cache if it exists and the main file. The page is then marked
45290 ** if the pager is in OPEN state.
45356 ** and if the pager requires a journal-sync, then mark the page as
45392 ** already in the journal file (recorded in Pager.pInJournal) and
45405 /* If this was page 1, then restore the value of Pager.dbFileVers.
45424 ** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not
45461 static int pager_delmaster(Pager *pPager, const char *zMaster){
45556 ** If the main database file is not open, or the pager is not in either
45571 static int pager_truncate(Pager *pPager, Pgno nPage){
45582 /* TODO: Is it safe to use Pager.dbFileSize here? */
45619 ** Set the value of the Pager.sectorSize variable for the given
45620 ** pager based on the value returned by the xSectorSize method
45641 static void setSectorSize(Pager *pPager){
45710 ** If the journal really is hot, reset the pager cache prior rolling
45714 static int pager_playback(Pager *pPager, int isHot){
45741 ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that
45841 ** code. This will cause the pager to enter the error state
45902 /* The Pager.sectorSize variable may have been updated while rolling
45916 ** If page 1 is read, then the value of Pager.dbFileVers[] is set to
45923 Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
46003 ** is actually a pointer to the Pager structure.
46013 Pager *pPager = (Pager *)pCtx;
46050 static int pagerRollbackWal(Pager *pPager){
46083 Pager *pPager, /* Pager object */
46149 static int pagerBeginReadTransaction(Pager *pPager){
46176 ** in pages (assuming the page size currently stored in Pager.pageSize).
46182 static int pagerPagecount(Pager *pPager, Pgno *pnPage){
46186 ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or
46213 ** configured maximum pager number, increase the allowed limit so
46230 ** If the database is not empty and the *-wal file exists, open the pager
46232 ** if no error occurs, make sure Pager.journalMode is not set to
46243 static int pagerOpenWalIfPresent(Pager *pPager){
46307 ** In either case, before playback commences the Pager.dbSize variable
46312 static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){
46423 SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
46430 static void pagerFixMaplimit(Pager *pPager){
46445 SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int64 szMmap){
46451 ** Free as much memory as possible from the pager.
46453 SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){
46458 ** Adjust settings of the pager to those specified in the pgFlags parameter.
46505 Pager *pPager, /* The pager to set safety level for */
46562 Pager *pPager, /* The pager object */
46582 ** The pager invokes the busy-handler if sqlite3OsLock() returns
46598 ** returned to the caller of the pager API function.
46601 Pager *pPager, /* Pager object */
46617 ** Change the page size used by the Pager object. The new page size
46620 ** If the pager is in the error state when this function is called, it
46634 ** then the pager object page size is set to *pPageSize.
46637 ** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt
46642 ** conditions above is not true, the pager was in error state when this
46646 SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
46651 ** of the Pager object is internally consistent.
46653 ** At one point this function returned an error if the pager was in
46703 ** by the pager. This is a buffer that is big enough to hold the
46709 SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){
46720 SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
46757 ** If the pager was opened on a transient file (zFilename==""), or
46767 SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){
46773 ** the Pager object. There has not been an opportunity to transition
46790 ** the pager. It returns the total number of pages in the database.
46795 SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){
46813 ** the lock. If the lock is obtained successfully, set the Pager.state
46816 static int pager_wait_on_lock(Pager *pPager, int locktype){
46862 static void assertTruncateConstraint(Pager *pPager){
46872 ** just sets the internal state of the pager object so that the
46880 SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
46891 ** Pager object may still have open savepoints (Pager.nSavepoint!=0),
46911 static int pagerSyncHotJournal(Pager *pPager){
46933 Pager *pPager, /* Pager object */
46975 Pager *pPager = pPg->pPager;
46985 Pager.pMmapFreelist list.
46987 static void pagerFreeMapHdrs(Pager *pPager){
47011 SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){
47033 ** If an error occurs while trying to sync the journal, shift the pager
47085 ** If the Pager.noSync flag is set, then this function is a no-op.
47095 ** been written following it. If the pager is operating in full-sync
47115 static int syncJournal(Pager *pPager, int newHdr){
47137 ** than Pager.journalOff bytes. If the next thing in the journal
47148 ** a valid header following Pager.journalOff, then write a 0x00
47216 /* Unless the pager is in noSync mode, the journal file was just
47233 ** The pager must hold at least a RESERVED lock when this function
47238 ** If the pager is a temp-file pager and the actual file-system file
47246 ** * The page number is greater than Pager.dbSize, or
47249 ** If writing out a page causes the database file to grow, Pager.dbFileSize
47251 ** in Pager.dbFileVers[] is updated to match the new value stored in
47258 static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
47292 ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to
47312 /* If page 1 was just written, update Pager.dbFileVers to match
47324 /* Update any backup objects copying the contents of this pager. */
47349 static int openSubJournal(Pager *pPager){
47374 Pager *pPager = pPg->pPager;
47419 ** soft memory limit. The first argument is a pointer to a Pager object
47420 ** (cast as a void*). The pager is always 'purgeable' (not an in-memory
47423 ** is always associated with the Pager object passed as the first
47437 Pager *pPager = (Pager *)p;
47504 ** Allocate and initialize a new Pager object and put a pointer to it
47505 ** in *ppPager. The pager should eventually be freed by passing it
47520 ** operation of the pager. It should be passed some bitwise combination
47526 ** If the pager object is allocated and the specified file opened
47528 ** the new pager object. If an error occurs, *ppPager is set to NULL
47535 Pager **ppPager, /* OUT: Return the Pager structure here */
47543 Pager *pPager = 0; /* Pager object to allocate and return */
47622 /* Allocate memory for the Pager structure, PCache object, the
47626 ** Pager object (sizeof(Pager) bytes)
47635 ROUND8(sizeof(*pPager)) + /* Pager structure */
47650 pPager = (Pager*)(pPtr);
47658 /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */
47678 /* Open the pager file.
47747 ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer.
47763 /* If an error occurred above, free the Pager structure and close the file.
47830 ** under the pager. Return SQLITE_OK if the database is still were it ought
47834 static int databaseIsUnmoved(Pager *pPager){
47857 ** the file-system for the given pager. A hot journal is one that
47885 static int hasHotJournal(Pager *pPager, int *pExists){
47985 ** 1) If the pager is currently in PAGER_OPEN state (no lock held
47994 ** 2) If the pager is running in exclusive-mode, and there are currently
48004 SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
48008 ** outstanding pages. This implies that the pager state should either
48009 ** be OPEN or READER. READER is only possible if the pager is or was in
48055 ** Unless the pager is in locking_mode=exclusive mode, the lock is
48073 ** may mean that the pager was in the error-state when this
48117 ** the file. If the unlock attempt fails, then Pager.eLock must be
48121 ** In order to get pager_unlock() to do this, set Pager.eState to
48125 ** shortly transition the pager object to the OPEN state. Calling
48179 ** In this case there may exist a Pager.pMap mapping that appears
48220 ** transaction and unlock the pager.
48226 static void pagerUnlockIfUnused(Pager *pPager){
48233 pager pPager (a page
48265 ** to pgno in Pager.pInJournal (bitvec of pages already written to the
48283 Pager *pPager, /* The pager open on the database file */
48317 /* If the pager is in the error state, return an error immediately.
48373 ** pager was already in the error-state when this function was called.
48390 /* The pager cache has created a new page. Its content needs to
48464 SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
48484 Pager *pPager;
48503 ** Open the journal file for pager pPager and write a journal header
48514 ** Pager.pInJournal bitvec structure is allocated.
48517 ** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or
48520 static int pager_open_journal(Pager *pPager){
48593 ** Begin a write-transaction on the specified pager object. If a
48609 SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
48620 /* If the pager is configured to use locking_mode=exclusive, and an
48652 ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD
48679 Pager *pPager = pPg->pPager;
48732 ** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs
48736 Pager *pPager = pPg->pPager;
48758 ** an error might occur and the pager would end up in WRITER_LOCKED state
48834 Pager *pPager = pPg->pPager; /* The pager that owns pPg */
48922 Pager *pPager = pPg->pPager;
48949 ** A call to this routine tells the pager that it is not necessary to
48956 ** on the given page is unused. The pager marks the page as clean so
48963 Pager *pPager = pPg->pPager;
48976 ** byte offset 24 of the pager file. The secondary change counter at
48995 static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
49053 /* Update the pager's copy of the change-counter. Otherwise, the
49073 ** or pages with the Pager.noSync flag set.
49075 ** If successful, or if called on a pager for which it is a no-op, this
49078 SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){
49104 SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
49118 ** Sync the database file for the pager pPager. zMaster points to the name
49144 Pager *pPager, /* Pager object */
49313 ** If an error occurs, an IO error code is returned and the pager
49316 SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){
49331 ** this transaction, the pager is running in exclusive-mode and is
49338 ** header. Since the pager is in exclusive mode, there is no need
49359 ** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR
49362 ** If the pager is already in PAGER_ERROR state when this function is called,
49363 ** it returns Pager.errCode immediately. No work is performed in this case.
49382 SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){
49387 ** the pager is already in the ERROR state, the rollback is not
49403 /* This can happen using journal_mode=off. Move the pager to the error
49421 /* If an error occurs during a ROLLBACK, we can no longer trust the pager
49431 SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){
49439 SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){
49446 ** used by the pager and its associated cache.
49448 SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){
49467 SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){
49491 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){
49509 ** Return true if this is an in-memory pager.
49511 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){
49525 static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){
49529 PagerSavepoint *aNew; /* New Pager.aSavepoint array */
49535 /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM
49570 SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){
49594 ** (the first created). A value of (Pager.nSavepoint-1) means operate
49596 ** (Pager.nSavepoint-1), then this function is a no-op.
49612 SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
49662 ** Except, if the pager is in-memory only, then return an empty string if
49669 SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager *pPager, int nullIfMemDb){
49674 ** Return the VFS structure for the pager.
49676 SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){
49682 ** with the pager. This might return NULL if the file has
49685 SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){
49692 SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){
49697 ** Return true if fsync() calls are disabled for this pager. Return FALSE
49700 SQLITE_PRIVATE int sqlite3PagerNosync(Pager *pPager){
49706 ** Set or retrieve the codec for this pager
49709 Pager *pPager,
49722 SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){
49740 ** Return the current pager state
49742 SQLITE_PRIVATE int sqlite3PagerState(Pager *pPager){
49773 SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
49873 ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC
49922 ** Return a pointer to the Pager.nExtra bytes of "extra" space
49930 ** Get/set the locking-mode for this pager. Parameter eMode must be one
49939 SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){
49953 ** Set the journal-mode for this pager. Parameter eMode must be one of:
49972 SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
50013 ** mode except WAL, unless the pager is in locking_mode=exclusive mode,
50070 SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
50075 ** Return TRUE if the pager is in a state where it is OK to change the
50079 SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
50092 SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
50106 SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){
50112 ** Unless this is an in-memory or temporary database, clear the pager cache.
50114 SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){
50127 SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){
50140 SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){
50145 ** Return true if the underlying VFS for the given pager supports the
50148 SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){
50157 static int pagerExclusiveLock(Pager *pPager){
50172 ** Call sqlite3WalOpen() to open the WAL handle. If the pager is in
50177 static int pagerOpenWal(Pager *pPager){
50183 /* If the pager is already in exclusive-mode, the WAL module will use
50211 ** If the pager passed as the first argument is open on a real database
50214 ** return SQLITE_OK. If an error occurs or the VFS used by the pager does
50218 ** If the pager is open on a temp-file (or in-memory database), or if
50223 Pager *pPager, /* Pager object */
50261 SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){
50302 ** A read-lock must be held on the pager when this function is called. If
50303 ** the pager is in WAL mode and the WAL file currently contains one or more
50308 SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
50317 /************** End of pager.c ***********************************************/
52664 ** Pager layer will use this to know that is cache is stale and
53387 ** performed, then the pager-cache associated with pWal is now
53389 ** next time the pager opens a snapshot on this database it knows that
53426 ** operation must occur while the pager is still holding the exclusive
53433 ** routine is a no-op. The pager must already hold the exclusive lock
53437 ** not actually change anything. The pager uses this to see if it
53449 ** locks are taken in this case). Nor should the pager attempt to
53820 DbPage *pDbPage; /* Pager page handle */
53936 Pager *pPager; /* The page cache */
54197 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
54604 ** Enable or disable the shared pager and schema features.
55087 ** page from the pager layer with the 'no-content' flag set. True otherwise.
56400 ** Convert a DbPage obtained from the pager into a MemPage used by
56414 ** Get a page from the pager. Initialize the MemPage.pBt and
56442 ** Retrieve a page from the pager cache. If the requested page is not
56443 ** already in the pager cache return NULL. Initialize the MemPage.pBt and
56470 ** Get a page from the pager and initialize it.
56579 ** During a rollback, when the pager reloads information into the cache
56900 /* If the B-Tree was successfully opened, set the pager-cache size to the
56901 ** default value. Except, when opening on an existing shared pager-cache,
56902 ** do not change the pager-cache size.
57059 ** value of mxPage. If mxPage is negative, the pager will
57743 /* This call makes sure that the pager has the correct number of
57884 Pager *pPager = pBt->pPager;
58133 Pager *pPager = pBt->pPager;
58255 ** call below will unlock the pager. */
58265 ** pager if this call closed the only read or write transaction. */
58285 ** Normally, if an error occurs while the pager layer is attempting to
58291 ** functions return code. So, even if an error occurs in the pager layer,
58293 ** transaction has been closed. This is quite safe, as the pager will have
58489 /* At the pager level, a statement transaction is a savepoint with
58551 ** 2: Other database connections that share the same pager cache
60246 ** pager layer with the 'no-content' flag set. This prevents the pager
60251 ** not set the no-content flag. This causes the pager to load and journal
60254 ** Note that the pager will not actually attempt to load or journal
61913 ** we do the detection here in order to avoid populating the pager
63143 ** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
63144 ** database file. It is a number computed by the pager. But its access
63278 ** Return the pager associated with a BTree. This routine is used for
63281 SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){
63904 ** The pager filename is invariant as long as the pager is
63917 ** The pager journal filename is invariant as long as the pager is
64216 int isAttached; /* True once backup has been registered with pager */
64217 sqlite3_backup *pNext; /* Next backup associated with source pager */
64232 ** invoked by the pager layer to report various state changes in
64417 Pager * const pDestPager = sqlite3BtreePager(p->pDest);
64482 ** and the pager code use this trick (clearing the first byte
64517 ** Register this backup object with the associated source pager for
64549 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
64550 Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */
64555 /* If the source pager is currently in a write-transaction, return
64591 ** source pager for the number of pages in the database.
64791 /* Detach this backup from the source pager. */
64875 ** has been modified by a transaction on the source pager. Copy
64895 ** Restart the backup process. This is called when the pager layer
69134 ** pagerStress() in pager.c), the rollback is required to restore
69135 ** the pager to a consistent state.
76079 ** P3==3 is the recommended pager cache size, and so forth. P1==0 is
76110 ** P2==2 is the database format. P2==3 is the recommended pager cache
78858 Pager *pPager; /* Pager associated with pBt */
92076 Pager *pPager;
106037 ** Set the safety_level and pager flags for pager iDb. Or if iDb<0
106086 ** defined in pager.h. This function returns the associated lowercase
106304 ** buffer that the pager module resizes using sqlite3_realloc().
106388 Pager *pPager;
106467 Pager *pPager = sqlite3BtreePager(pDb->pBt);
106734 Pager *pPager = sqlite3BtreePager(pDb->pBt);
106741 Pager *pPager = sqlite3BtreePager(pDb->pBt);
116568 ** An optimisation would be to use a non-journaled pager.
116764 ** vacuum database. The vacuum_db journal file is deleted when the pager
131558 Pager *pPager = sqlite3BtreePager(pBt);
131728 ** at the b-tree/pager level.
131897 ** the pager rollback and schema reset an atomic operation. */
132899 ** a temporary file for transient pager files and statement journals.
133660 ** database it is 'NONE'. This matches the pager layer defaults.
134186 Pager *pPager;
140733 ** of the number of overflow pages that will be loaded by the pager layer
161929 ** level pager to use "journal_mode=off". This prevents it from
163292 Pager *pPager = sqlite3BtreePager(pBt);
163321 Pager *pPager = sqlite3BtreePager(pBt);