Lines Matching defs:pager
1461 ** The "data version" for the pager is written into the pointer. The
8358 ** from the pager.
8798 ** memory used by all pager caches associated with the database connection.)^
8804 ** pager cache is shared between two or more connections the bytes of heap
8805 ** memory used by that pager cache is divided evenly between the attached
8806 ** connections.)^ In other words, if none of the pager caches associated
8808 ** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
8830 ** <dd>This parameter returns the number of pager cache hits that have
8836 ** <dd>This parameter returns the number of pager cache misses that have
10369 ** pages in the pager-cache that are not currently in use are written out
14634 ** callback for the database handle. Each pager opened via the sqlite
14636 ** callback is currently invoked only from within pager.c.
15081 ** actual data in the bytes used for locking. The pager never allocates
15166 /************** Include pager.h in the middle of sqliteInt.h *****************/
15167 /************** Begin file pager.h *******************************************/
15217 ** roll back. See comments for function writeSuperJournal() in pager.c
15332 /* Functions used to manage pager transactions and savepoints. */
15375 /* Functions used to query pager state and configuration. */
15419 /************** End of pager.h ***********************************************/
15480 ** pager.h.
15520 /* in vdbe.c and pager.c See https://sqlite.org/lang_savepoint.html */
15570 ** It is a read-only number computed by the pager. But we merge it with
16510 Pager *pPager; /* The pager this page is part of */
16549 /* Create a new pager cache.
16626 /* Set and get the suggested cache-size for the specified pager-cache.
16629 ** the total number of pages cached by purgeable pager-caches to the sum
16637 /* Set or get the suggested spill-size for the specified pager-cache.
17184 #define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */
40947 /* The pager calls this method to signal that it has done
52927 ** structure in the pager.
53587 ** The pcache.c and pager.c modules deal pointers to PgHdr objects.
54763 ** held by the pager system. Memory in use by any SQLite pager allocated
55322 /************** Begin file pager.c *******************************************/
55334 ** This is the implementation of the page cache subsystem or "pager".
55336 ** The pager is used to access a database disk file. It implements
55338 ** is separate from the database file. The pager also implements file
55345 /************** Include wal.h in the middle of pager.c ***********************/
55399 ** There is one object of this type for each pager.
55467 ** by the pager layer on the database file.
55504 /************** Continuing where we left off in pager.c **********************/
55616 ** The Pager.eState variable stores the current 'state' of a pager. A
55617 ** pager may be in any one of the seven states shown in the following
55655 ** The pager starts up in this state. Nothing is guaranteed in this
55666 ** rollback (non-WAL) mode are met. Unless the pager is (or recently
55689 ** The pager moves to this state from READER when a write-transaction
55712 ** * The contents of the pager cache have not been modified.
55718 ** A pager moves from WRITER_LOCKED state to this state when a page is
55731 ** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state
55747 ** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD
55765 ** difficult to be sure that the in-memory pager state (cache contents,
55768 ** Temporary pager files may enter the ERROR state, but in-memory pagers
55777 ** file. To avoid this hazard, the pager switches into the ERROR state
55780 ** Once it has entered the ERROR state, any attempt to use the pager
55782 ** outstanding transactions have been abandoned, the pager is able to
55786 ** when a read-transaction is next opened on the pager (transitioning
55787 ** the pager into READER state). At that point the system has recovered
55790 ** Specifically, the pager jumps into the ERROR state if:
55804 ** persists, the pager enters the ERROR state via condition (1) above.
55810 ** read-only statement cannot leave the pager in an internally inconsistent
55815 ** last reference is dropped the pager should move back to OPEN state).
55816 ** * The pager is not an in-memory pager.
55821 ** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the
55828 ** executed), and when the pager is leaving the "error state".
55860 ** The exception is when the database file is unlocked as the pager moves
55863 ** transition, by the same pager or any other). If the call to xUnlock()
55864 ** fails at this point and the pager is left holding an EXCLUSIVE lock, this
55885 ** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in
55952 ** The current 'state' of the pager object. See the comment and state
55953 ** diagram above for a description of the pager state.
55962 ** databases always have Pager.exclusiveMode==1, this tricks the pager
56010 ** is cleared anyway (and the pager will move to ERROR state).
56036 ** sub-journals are only used for in-memory pager files.
56133 ** when the pager is first created or else only change when there is a
56136 ** the "state" of the pager, while other class members describe the
56137 ** "configuration" of the pager.
56266 ** The journal header size for this pager. This is usually the same
56380 ** this means an in-memory pager performs no IO at all, it cannot encounter
56384 ** is therefore not possible for an in-memory pager to enter the ERROR
56472 /* There must be at least one outstanding reference to the pager if
56473 ** in ERROR state. Otherwise the pager should have already dropped
56549 ** content from the pager.
56687 ** atomic-batch-write optimizations can be used with this pager. The
56785 ** When this is called the journal file for pager pPager must be open.
56886 ** if the pager is not in no-sync mode, sync the journal file immediately
56987 ** * When the pager is in no-sync mode. Corruption can follow a
57173 ** Write the supplied super-journal name into the journal file for pager
57175 ** thing written to a journal file. If the pager is in full-sync mode, the
57238 /* If the pager is in peristent-journal mode, then the physical
57275 ** if it is open and the pager is not in exclusive mode.
57312 ** This function is a no-op if the pager is in exclusive mode and not
57313 ** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN
57316 ** If the pager is not in exclusive-access mode, the database file is
57321 ** If the pager is in ERROR state when this function is called, the
57322 ** contents of the pager cache are discarded before switching back to
57323 ** the OPEN state. Regardless of whether the pager is in exclusive-mode
57364 /* If the pager is in the ERROR state and the call to unlock the database
57374 /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
57382 /* If Pager.errCode is set, the contents of the pager cache cannot be
57383 ** trusted. Now that there are no outstanding references to the pager,
57408 ** the pager to transition into the ERROR state may ahve occurred.
57409 ** The first argument is a pointer to the pager structure, the second
57410 ** the error-code about to be returned by a pager API function. The
57414 ** IOERR sub-codes, the pager enters the ERROR state and the error code
57415 ** is stored in Pager.errCode. While the pager remains in the ERROR state,
57418 ** The ERROR state indicates that the contents of the pager-cache
57420 ** the contents of the pager-cache. If a transaction was active when
57483 ** depends on whether or not the pager is running in exclusive mode and
57501 ** If the pager is running in exclusive mode, this method of finalizing
57503 ** DELETE and the pager is in exclusive mode, the method described under
57506 ** After the journal is finalized, the pager moves to PAGER_READER state.
57523 /* Do nothing if the pager does not have an open write transaction
57653 ** If the pager has already entered the ERROR state, do not attempt
57656 ** the database file and move the pager back to OPEN state. If this
57658 ** connection to obtain a shared lock on the pager (which may be this one)
57661 ** If the pager has not already entered the ERROR state, but an IO or
57663 ** the pager to enter the ERROR state. Which will be cleared by the
57728 ** pager as it is in the source. This comes up when a VACUUM changes the
57777 Pager *pPager, /* The pager being played back */
57807 ** a hot-journal rollback. If it is a hot-journal rollback, the pager
57859 /* If the pager is in CACHEMOD state, then there must be a copy of this
57860 ** page in the pager cache. In this case just update the pager cache,
57865 ** not be in the pager cache. Later: if a malloc() or IO error occurs
57871 ** pager cache if it exists and the main file. The page is then marked
57874 ** if the pager is in OPEN state.
57960 ** and if the pager requires a journal-sync, then mark the page as
58150 ** If the main database file is not open, or the pager is not in either
58215 ** pager based on the value returned by the xSectorSize method
58305 ** If the journal really is hot, reset the pager cache prior rolling
58440 ** code. This will cause the pager to enter the error state
58819 ** configured maximum pager number, increase the allowed limit so
58836 ** If the database is not empty and the *-wal file exists, open the pager
59065 ** Free as much memory as possible from the pager.
59072 ** Adjust settings of the pager to those specified in the pgFlags parameter.
59124 Pager *pPager, /* The pager to set safety level for */
59184 Pager *pPager, /* The pager object */
59204 ** The pager invokes the busy-handler if sqlite3OsLock() returns
59220 ** returned to the caller of the pager API function.
59240 ** If the pager is in the error state when this function is called, it
59254 ** then the pager object page size is set to *pPageSize.
59262 ** conditions above is not true, the pager was in error state when this
59273 ** At one point this function returned an error if the pager was in
59329 ** by the pager. This is a buffer that is big enough to hold the
59386 ** If the pager was opened on a transient file (zFilename==""), or
59419 ** the pager. It returns the total number of pages in the database.
59508 ** just sets the internal state of the pager object so that the
59636 ** under the pager. Return SQLITE_OK if the database is still where it ought
59705 ** If an error occurs while trying to sync the journal, shift the pager
59767 ** been written following it. If the pager is operating in full-sync
59888 /* Unless the pager is in noSync mode, the journal file was just
59905 ** The pager must hold at least a RESERVED lock when this function
59910 ** If the pager is a temp-file pager and the actual file-system file
59997 /* Update any backup objects copying the contents of this pager. */
60101 ** (cast as a void*). The pager is always 'purgeable' (not an in-memory
60213 ** in *ppPager. The pager should eventually be freed by passing it
60230 ** operation of the pager. It should be passed some bitwise combination
60236 ** If the pager object is allocated and the specified file opened
60238 ** the new pager object. If an error occurs, *ppPager is set to NULL
60456 /* Open the pager file.
60628 ** the file-system for the given pager. A hot journal is one that
60757 ** 1) If the pager is currently in PAGER_OPEN state (no lock held
60766 ** 2) If the pager is running in exclusive-mode, and there are currently
60780 ** outstanding pages. This implies that the pager state should either
60781 ** be OPEN or READER. READER is only possible if the pager is or was in
60827 ** Unless the pager is in locking_mode=exclusive mode, the lock is
60845 ** may mean that the pager was in the error-state when this
60897 ** shortly transition the pager object to the OPEN state. Calling
60987 ** transaction and unlock the pager.
61006 ** on the current state of the pager.
61009 ** getPageError() -- Used if the pager is in an error state
61058 Pager *pPager, /* The pager open on the database file */
61098 /* The pager cache has created a new page. Its content needs to
61160 Pager *pPager, /* The pager open on the database file */
61230 /* The page getter method for when the pager is an error state */
61232 Pager *pPager, /* The pager open on the database file */
61248 Pager *pPager, /* The pager open on the database file */
61321 ** Open the journal file for pager pPager and write a journal header
61413 ** Begin a write-transaction on the specified pager object. If a
61440 /* If the pager is configured to use locking_mode=exclusive, and an
61578 ** an error might occur and the pager would end up in WRITER_LOCKED state
61654 Pager *pPager = pPg->pPager; /* The pager that owns pPg */
61771 ** A call to this routine tells the pager that it is not necessary to
61778 ** on the given page is unused. The pager marks the page as clean so
61805 ** byte offset 24 of the pager file. The secondary change counter at
61882 /* Update the pager's copy of the change-counter. Otherwise, the
61904 ** If successful, or if called on a pager for which it is a no-op, this
61947 ** Sync the database file for the pager pPager. zSuper points to the name
62199 ** If an error occurs, an IO error code is returned and the pager
62218 ** this transaction, the pager is running in exclusive-mode and is
62225 ** header. Since the pager is in exclusive mode, there is no need
62245 ** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR
62248 ** If the pager is already in PAGER_ERROR state when this function is called,
62273 ** the pager is already in the ERROR state, the rollback is not
62289 /* This can happen using journal_mode=off. Move the pager to the error
62308 /* If an error occurs during a ROLLBACK, we can no longer trust the pager
62333 ** used by the pager and its associated cache.
62403 ** Return true if this is an in-memory or temp-file backed pager.
62558 ** back journal_mode=off, put the pager in the error state. This way,
62559 ** if the VFS used by this pager includes ZipVFS, the entire transaction
62578 ** Except, if the pager is in-memory only, then return an empty string if
62594 ** Return the VFS structure for the pager.
62602 ** with the pager. This might return NULL if the file has
62630 ** Set or retrieve the codec for this pager
62800 ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC
62857 ** Get/set the locking-mode for this pager. Parameter eMode must be one
62880 ** Set the journal-mode for this pager. Parameter eMode must be one of:
62933 ** mode except WAL, unless the pager is in locking_mode=exclusive mode,
62994 ** Return TRUE if the pager is in a state where it is OK to change the
63031 ** Unless this is an in-memory or temporary database, clear the pager cache.
63049 Pager *pPager, /* Checkpoint on this pager */
63084 ** Return true if the underlying VFS for the given pager supports the
63112 ** Call sqlite3WalOpen() to open the WAL handle. If the pager is in
63123 /* If the pager is already in exclusive-mode, the WAL module will use
63151 ** If the pager passed as the first argument is open on a real database
63154 ** return SQLITE_OK. If an error occurs or the VFS used by the pager does
63158 ** If the pager is open on a temp-file (or in-memory database), or if
63241 ** If pager pPager is a wal-mode database not in exclusive locking mode,
63346 ** A read-lock must be held on the pager when this function is called. If
63347 ** the pager is in WAL mode and the WAL file currently contains one or more
63360 /************** End of pager.c ***********************************************/
65364 static int checkHeaderValid(Pager *pager, u8 *zBuf, const char *logStr);
67321 ** performed, then the pager-cache associated with pWal is now
67323 ** next time the pager opens a snapshot on this database it knows that
67374 ** operation must occur while the pager is still holding the exclusive
67381 ** routine is a no-op. The pager must already hold the exclusive lock
67385 ** not actually change anything. The pager uses this to see if it
67397 ** locks are taken in this case). Nor should the pager attempt to
67832 ** As each database page is loaded into memory, the pager allocats an
67834 ** "extra" information associated with each page of the pager.)
67844 /* Only the first 8 bytes (above) are zeroed by pager.c when a new page
68262 Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */
68677 ** Enable or disable the shared pager and schema features.
68720 static int checkHeaderValid(Pager *pager, u8 *zBuf, const char *logStr){
68722 if( pager==NULL || pager->pCodec ){
68737 Pager *pager = sqlite3BtreePager(p);
68738 return checkHeaderValid(pager, zBuf, "ckpt");
69241 ** page from the pager layer with the 'no-content' flag set. True otherwise.
70812 ** Convert a DbPage obtained from the pager into a MemPage used by
70829 ** Get a page from the pager. Initialize the MemPage.pBt and
70857 ** Retrieve a page from the pager cache. If the requested page is not
70858 ** already in the pager cache return NULL. Initialize the MemPage.pBt and
70884 ** Get a page from the pager and initialize it.
71009 ** During a rollback, when the pager reloads information into the cache
71341 /* If the B-Tree was successfully opened, set the pager-cache size to the
71342 ** default value. Except, when opening on an existing shared pager-cache,
71343 ** do not change the pager-cache size.
71533 ** the pager might attempt to "spill" pages to the journal early in
72287 /* This call makes sure that the pager has the correct number of
72830 ** call below will unlock the pager. */
72840 ** pager if this call closed the only read or write transaction. */
72860 ** Normally, if an error occurs while the pager layer is attempting to
72866 ** functions return code. So, even if an error occurs in the pager layer,
72868 ** transaction has been closed. This is quite safe, as the pager will have
73068 /* At the pager level, a statement transaction is a savepoint with
73134 ** 2: Other database connections that share the same pager cache
75125 ** pager layer with the 'no-content' flag set. This prevents the pager
75130 ** not set the no-content flag. This causes the pager to load and journal
75133 ** Note that the pager will not actually attempt to load or journal
78649 ** from the pager. The BTREE_DATA_VERSION value is not actually stored in the
78650 ** database file. It is a number computed by the pager. But its access
78782 ** Return the pager associated with a BTree. This routine is used for
79458 ** The pager filename is invariant as long as the pager is
79471 ** The pager journal filename is invariant as long as the pager is
79717 ** the in-memory pager cache.
79785 int isAttached; /* True once backup has been registered with pager */
79786 sqlite3_backup *pNext; /* Next backup associated with source pager */
79801 ** invoked by the pager layer to report various state changes in
80041 ** and the pager code use this trick (clearing the first byte
80076 ** Register this backup object with the associated source pager for
80108 Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */
80109 Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */
80114 /* If the source pager is currently in a write-transaction, return
80160 ** source pager for the number of pages in the database.
80359 /* Detach this backup from the source pager. */
80445 ** has been modified by a transaction on the source pager. Copy
80465 ** Restart the backup process. This is called when the pager layer
85741 ** pagerStress() in pager.c), the rollback is required to restore
85742 ** the pager to a consistent state.
94364 ** P3==3 is the recommended pager cache size, and so forth. P1==0 is
94395 ** P2==3 is the recommended pager cache
134447 ** Set the safety_level and pager flags for pager iDb. Or if iDb<0
134496 ** defined in pager.h. This function returns the associated lowercase
134815 ** buffer that the pager module resizes using sqlite3_realloc().
149721 ** An optimisation would be to use a non-journaled pager.
149747 /* For a VACUUM INTO, the pager-flags are set to the same values as
149915 ** vacuum database. The vacuum_db journal file is deleted when the pager
174290 ** Flush any dirty pages in the pager-cache for any attached database
174551 ** at the b-tree/pager level.
174755 ** the pager rollback and schema reset an atomic operation. */
175969 ** a temporary file for transient pager files and statement journals.
176889 ** database it is OFF. This matches the pager layer defaults.
177987 ** Memory layout must be compatible with that generated by the pager
184679 ** of the number of overflow pages that will be loaded by the pager layer
212900 ** level pager to use "journal_mode=off". This prevents it from
214213 ** The pager and btree modules arrange objects in memory so that there are
214511 ** to sqlite3_reset() may cause the pager to be reset (emptied). It is
215103 ** pages of the database file. The pager interface is used so that