Increase the maximum page size from 32k to 64k.
FossilOrigin-Name: 45362437d491fbe0f033a67b398f8ba68cbf1b3b
This commit is contained in:
+31
-24
@@ -1155,6 +1155,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
|
||||
assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );
|
||||
gap = pPage->cellOffset + 2*pPage->nCell;
|
||||
top = get2byte(&data[hdr+5]);
|
||||
if( top==0 ) top = 65536;
|
||||
if( gap>top ) return SQLITE_CORRUPT_BKPT;
|
||||
testcase( gap+2==top );
|
||||
testcase( gap+1==top );
|
||||
@@ -1165,6 +1166,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
|
||||
rc = defragmentPage(pPage);
|
||||
if( rc ) return rc;
|
||||
top = get2byte(&data[hdr+5]);
|
||||
if( top==0 ) top = 65536;
|
||||
}else if( gap+2<=top ){
|
||||
/* Search the freelist looking for a free slot big enough to satisfy
|
||||
** the request. The allocation is made from the first free slot in
|
||||
@@ -1207,6 +1209,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
|
||||
rc = defragmentPage(pPage);
|
||||
if( rc ) return rc;
|
||||
top = get2byte(&data[hdr+5]);
|
||||
if( top==0 ) top = 65536;
|
||||
assert( gap+nByte<=top );
|
||||
}
|
||||
|
||||
@@ -1372,10 +1375,10 @@ static int btreeInitPage(MemPage *pPage){
|
||||
u8 hdr; /* Offset to beginning of page header */
|
||||
u8 *data; /* Equal to pPage->aData */
|
||||
BtShared *pBt; /* The main btree structure */
|
||||
u16 usableSize; /* Amount of usable space on each page */
|
||||
u16 cellOffset; /* Offset from start of page to first cell pointer */
|
||||
u16 nFree; /* Number of unused bytes on the page */
|
||||
u16 top; /* First byte of the cell content area */
|
||||
int usableSize; /* Amount of usable space on each page */
|
||||
int cellOffset; /* Offset from start of page to first cell pointer */
|
||||
int nFree; /* Number of unused bytes on the page */
|
||||
int top; /* First byte of the cell content area */
|
||||
int iCellFirst; /* First allowable cell or freeblock offset */
|
||||
int iCellLast; /* Last possible cell or freeblock offset */
|
||||
|
||||
@@ -1384,12 +1387,13 @@ static int btreeInitPage(MemPage *pPage){
|
||||
hdr = pPage->hdrOffset;
|
||||
data = pPage->aData;
|
||||
if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
|
||||
assert( pBt->pageSize>=512 && pBt->pageSize<=32768 );
|
||||
pPage->maskPage = pBt->pageSize - 1;
|
||||
assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
|
||||
pPage->maskPage = (u16)(pBt->pageSize - 1);
|
||||
pPage->nOverflow = 0;
|
||||
usableSize = pBt->usableSize;
|
||||
pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;
|
||||
top = get2byte(&data[hdr+5]);
|
||||
if( top==0 ) top = 65536;
|
||||
pPage->nCell = get2byte(&data[hdr+3]);
|
||||
if( pPage->nCell>MX_CELL(pBt) ){
|
||||
/* To many cells for a single page. The page must be corrupt */
|
||||
@@ -1493,8 +1497,8 @@ static void zeroPage(MemPage *pPage, int flags){
|
||||
pPage->hdrOffset = hdr;
|
||||
pPage->cellOffset = first;
|
||||
pPage->nOverflow = 0;
|
||||
assert( pBt->pageSize>=512 && pBt->pageSize<=32768 );
|
||||
pPage->maskPage = pBt->pageSize - 1;
|
||||
assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
|
||||
pPage->maskPage = (u16)(pBt->pageSize - 1);
|
||||
pPage->nCell = 0;
|
||||
pPage->isInit = 1;
|
||||
}
|
||||
@@ -1802,7 +1806,7 @@ int sqlite3BtreeOpen(
|
||||
#ifdef SQLITE_SECURE_DELETE
|
||||
pBt->secureDelete = 1;
|
||||
#endif
|
||||
pBt->pageSize = get2byte(&zDbHeader[16]);
|
||||
pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
|
||||
if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
|
||||
|| ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
|
||||
pBt->pageSize = 0;
|
||||
@@ -2116,7 +2120,7 @@ int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){
|
||||
((pageSize-1)&pageSize)==0 ){
|
||||
assert( (pageSize & 7)==0 );
|
||||
assert( !pBt->pPage1 && !pBt->pCursor );
|
||||
pBt->pageSize = (u16)pageSize;
|
||||
pBt->pageSize = (u32)pageSize;
|
||||
freeTempSpace(pBt);
|
||||
}
|
||||
rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
|
||||
@@ -2310,9 +2314,10 @@ static int lockBtree(BtShared *pBt){
|
||||
if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
|
||||
goto page1_init_failed;
|
||||
}
|
||||
pageSize = get2byte(&page1[16]);
|
||||
if( ((pageSize-1)&pageSize)!=0 || pageSize<512 ||
|
||||
(SQLITE_MAX_PAGE_SIZE<32768 && pageSize>SQLITE_MAX_PAGE_SIZE)
|
||||
pageSize = (page1[16]<<8) | (page1[17]<<16);
|
||||
if( ((pageSize-1)&pageSize)!=0
|
||||
|| pageSize>SQLITE_MAX_PAGE_SIZE
|
||||
|| pageSize<=256
|
||||
){
|
||||
goto page1_init_failed;
|
||||
}
|
||||
@@ -2326,8 +2331,8 @@ static int lockBtree(BtShared *pBt){
|
||||
** again with the correct page-size.
|
||||
*/
|
||||
releasePage(pPage1);
|
||||
pBt->usableSize = (u16)usableSize;
|
||||
pBt->pageSize = (u16)pageSize;
|
||||
pBt->usableSize = (u32)usableSize;
|
||||
pBt->pageSize = (u32)pageSize;
|
||||
freeTempSpace(pBt);
|
||||
rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize,
|
||||
pageSize-usableSize);
|
||||
@@ -2340,8 +2345,8 @@ static int lockBtree(BtShared *pBt){
|
||||
if( usableSize<480 ){
|
||||
goto page1_init_failed;
|
||||
}
|
||||
pBt->pageSize = (u16)pageSize;
|
||||
pBt->usableSize = (u16)usableSize;
|
||||
pBt->pageSize = (u32)pageSize;
|
||||
pBt->usableSize = (u32)usableSize;
|
||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||
pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);
|
||||
pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);
|
||||
@@ -2417,7 +2422,8 @@ static int newDatabase(BtShared *pBt){
|
||||
if( rc ) return rc;
|
||||
memcpy(data, zMagicHeader, sizeof(zMagicHeader));
|
||||
assert( sizeof(zMagicHeader)==16 );
|
||||
put2byte(&data[16], pBt->pageSize);
|
||||
data[16] = (pBt->pageSize>>8)&0xff;
|
||||
data[17] = (pBt->pageSize>>16)&0xff;
|
||||
data[18] = 1;
|
||||
data[19] = 1;
|
||||
assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
|
||||
@@ -4428,9 +4434,9 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
pCur->validNKey = 1;
|
||||
pCur->info.nKey = nCellKey;
|
||||
}else{
|
||||
/* The maximum supported page-size is 32768 bytes. This means that
|
||||
/* The maximum supported page-size is 65536 bytes. This means that
|
||||
** the maximum number of record bytes stored on an index B-Tree
|
||||
** page is at most 8198 bytes, which may be stored as a 2-byte
|
||||
** page is less than 16384 bytes and may be stored as a 2-byte
|
||||
** varint. This information is used to attempt to avoid parsing
|
||||
** the entire cell by checking for the cases where the record is
|
||||
** stored entirely within the b-tree page by inspecting the first
|
||||
@@ -5399,7 +5405,7 @@ static void insertCell(
|
||||
if( *pRC ) return;
|
||||
|
||||
assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
|
||||
assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=5460 );
|
||||
assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921 );
|
||||
assert( pPage->nOverflow<=ArraySize(pPage->aOvfl) );
|
||||
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
||||
/* The cell should normally be sized correctly. However, when moving a
|
||||
@@ -5479,12 +5485,12 @@ static void assemblePage(
|
||||
|
||||
assert( pPage->nOverflow==0 );
|
||||
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
||||
assert( nCell>=0 && nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=5460 );
|
||||
assert( nCell>=0 && nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921);
|
||||
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
|
||||
|
||||
/* Check that the page has just been zeroed by zeroPage() */
|
||||
assert( pPage->nCell==0 );
|
||||
assert( get2byte(&data[hdr+5])==nUsable );
|
||||
assert( get2byte(&data[hdr+5])==(nUsable&0xffff) );
|
||||
|
||||
pCellptr = &data[pPage->cellOffset + nCell*2];
|
||||
cellbody = nUsable;
|
||||
@@ -7659,7 +7665,8 @@ static int checkTreePage(
|
||||
if( hit==0 ){
|
||||
pCheck->mallocFailed = 1;
|
||||
}else{
|
||||
u16 contentOffset = get2byte(&data[hdr+5]);
|
||||
int contentOffset = get2byte(&data[hdr+5]);
|
||||
if( contentOffset==0 ) contentOffset = 65536;
|
||||
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
|
||||
memset(hit+contentOffset, 0, usableSize-contentOffset);
|
||||
memset(hit, 1, contentOffset);
|
||||
|
||||
+3
-3
@@ -46,7 +46,7 @@
|
||||
**
|
||||
** The file is divided into pages. The first page is called page 1,
|
||||
** the second is page 2, and so forth. A page number of zero indicates
|
||||
** "no such page". The page size can be any power of 2 between 512 and 32768.
|
||||
** "no such page". The page size can be any power of 2 between 512 and 65536.
|
||||
** Each page can be either a btree page, a freelist page, an overflow
|
||||
** page, or a pointer-map page.
|
||||
**
|
||||
@@ -413,14 +413,14 @@ struct BtShared {
|
||||
u8 autoVacuum; /* True if auto-vacuum is enabled */
|
||||
u8 incrVacuum; /* True if incr-vacuum is enabled */
|
||||
#endif
|
||||
u16 pageSize; /* Total number of bytes on a page */
|
||||
u16 usableSize; /* Number of usable bytes on each page */
|
||||
u16 maxLocal; /* Maximum local payload in non-LEAFDATA tables */
|
||||
u16 minLocal; /* Minimum local payload in non-LEAFDATA tables */
|
||||
u16 maxLeaf; /* Maximum local payload in a LEAFDATA table */
|
||||
u16 minLeaf; /* Minimum local payload in a LEAFDATA table */
|
||||
u8 inTransaction; /* Transaction state */
|
||||
u8 doNotUseWAL; /* If true, do not open write-ahead-log file */
|
||||
u32 pageSize; /* Total number of bytes on a page */
|
||||
u32 usableSize; /* Number of usable bytes on each page */
|
||||
int nTransaction; /* Number of open transactions (read + write) */
|
||||
u32 nPage; /* Number of pages in the database */
|
||||
void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
|
||||
|
||||
+6
-9
@@ -1505,7 +1505,6 @@ static int readJournalHdr(
|
||||
if( pPager->journalOff==0 ){
|
||||
u32 iPageSize; /* Page-size field of journal header */
|
||||
u32 iSectorSize; /* Sector-size field of journal header */
|
||||
u16 iPageSize16; /* Copy of iPageSize in 16-bit variable */
|
||||
|
||||
/* Read the page-size and sector-size journal header fields. */
|
||||
if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))
|
||||
@@ -1535,10 +1534,8 @@ static int readJournalHdr(
|
||||
** Use a testcase() macro to make sure that malloc failure within
|
||||
** PagerSetPagesize() is tested.
|
||||
*/
|
||||
iPageSize16 = (u16)iPageSize;
|
||||
rc = sqlite3PagerSetPagesize(pPager, &iPageSize16, -1);
|
||||
rc = sqlite3PagerSetPagesize(pPager, &iPageSize, -1);
|
||||
testcase( rc!=SQLITE_OK );
|
||||
assert( rc!=SQLITE_OK || iPageSize16==(u16)iPageSize );
|
||||
|
||||
/* Update the assumed sector-size to match the value used by
|
||||
** the process that created this journal. If this journal was
|
||||
@@ -3356,7 +3353,7 @@ void sqlite3PagerSetBusyhandler(
|
||||
** function was called, or because the memory allocation attempt failed,
|
||||
** then *pPageSize is set to the old, retained page size before returning.
|
||||
*/
|
||||
int sqlite3PagerSetPagesize(Pager *pPager, u16 *pPageSize, int nReserve){
|
||||
int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
|
||||
/* It is not possible to do a full assert_pager_state() here, as this
|
||||
** function may be called from within PagerOpen(), before the state
|
||||
** of the Pager object is internally consistent.
|
||||
@@ -3367,7 +3364,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u16 *pPageSize, int nReserve){
|
||||
** is a no-op for that case anyhow.
|
||||
*/
|
||||
|
||||
u16 pageSize = *pPageSize;
|
||||
u32 pageSize = *pPageSize;
|
||||
assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
|
||||
if( (pPager->memDb==0 || pPager->dbSize==0)
|
||||
&& sqlite3PcacheRefCount(pPager->pPCache)==0
|
||||
@@ -3392,7 +3389,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u16 *pPageSize, int nReserve){
|
||||
}
|
||||
}
|
||||
|
||||
*pPageSize = (u16)pPager->pageSize;
|
||||
*pPageSize = pPager->pageSize;
|
||||
if( nReserve<0 ) nReserve = pPager->nReserve;
|
||||
assert( nReserve>=0 && nReserve<1000 );
|
||||
pPager->nReserve = (i16)nReserve;
|
||||
@@ -4184,7 +4181,7 @@ int sqlite3PagerOpen(
|
||||
int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */
|
||||
int noReadlock = (flags & PAGER_NO_READLOCK)!=0; /* True to omit read-lock */
|
||||
int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */
|
||||
u16 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
|
||||
u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */
|
||||
|
||||
/* Figure out how much space is required for each journal file-handle
|
||||
** (there are two of them, the main journal and the sub-journal). This
|
||||
@@ -4319,7 +4316,7 @@ int sqlite3PagerOpen(
|
||||
if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){
|
||||
szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE;
|
||||
}else{
|
||||
szPageDflt = (u16)pPager->sectorSize;
|
||||
szPageDflt = (u32)pPager->sectorSize;
|
||||
}
|
||||
}
|
||||
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
|
||||
|
||||
/* Functions used to configure a Pager object. */
|
||||
void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);
|
||||
int sqlite3PagerSetPagesize(Pager*, u16*, int);
|
||||
int sqlite3PagerSetPagesize(Pager*, u32*, int);
|
||||
int sqlite3PagerMaxPageCount(Pager*, int);
|
||||
void sqlite3PagerSetCachesize(Pager*, int);
|
||||
void sqlite3PagerSetSafetyLevel(Pager*,int,int);
|
||||
|
||||
+3
-4
@@ -133,9 +133,8 @@
|
||||
# define SQLITE_MAX_VARIABLE_NUMBER 999
|
||||
#endif
|
||||
|
||||
/* Maximum page size. The upper bound on this value is 32768. This a limit
|
||||
** imposed by the necessity of storing the value in a 2-byte unsigned integer
|
||||
** and the fact that the page size must be a power of 2.
|
||||
/* Maximum page size. The upper bound on this value is 65536. This a limit
|
||||
** imposed by the use of 16-bit offsets within each page.
|
||||
**
|
||||
** If this limit is changed, then the compiled library is technically
|
||||
** incompatible with an SQLite library compiled with a different limit. If
|
||||
@@ -145,7 +144,7 @@
|
||||
** lead to database corruption.
|
||||
*/
|
||||
#ifndef SQLITE_MAX_PAGE_SIZE
|
||||
# define SQLITE_MAX_PAGE_SIZE 32768
|
||||
# define SQLITE_MAX_PAGE_SIZE 65536
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ static int pager_open(
|
||||
int argc, /* Number of arguments */
|
||||
const char **argv /* Text of each argument */
|
||||
){
|
||||
u16 pageSize;
|
||||
u32 pageSize;
|
||||
Pager *pPager;
|
||||
int nPage;
|
||||
int rc;
|
||||
|
||||
+2
-2
@@ -1000,7 +1000,7 @@ static int testvfs_obj_cmd(
|
||||
int n;
|
||||
u8 *a = Tcl_GetByteArrayFromObj(objv[3], &n);
|
||||
int pgsz = pBuffer->pgsz;
|
||||
if( pgsz==0 ) pgsz = 32768;
|
||||
if( pgsz==0 ) pgsz = 65536;
|
||||
for(i=0; i*pgsz<n; i++){
|
||||
int nByte = pgsz;
|
||||
tvfsAllocPage(pBuffer, i, pgsz);
|
||||
@@ -1014,7 +1014,7 @@ static int testvfs_obj_cmd(
|
||||
pObj = Tcl_NewObj();
|
||||
for(i=0; pBuffer->aPage[i]; i++){
|
||||
int pgsz = pBuffer->pgsz;
|
||||
if( pgsz==0 ) pgsz = 32768;
|
||||
if( pgsz==0 ) pgsz = 65536;
|
||||
Tcl_AppendObjToObj(pObj, Tcl_NewByteArrayObj(pBuffer->aPage[i], pgsz));
|
||||
}
|
||||
Tcl_SetObjResult(interp, pObj);
|
||||
|
||||
@@ -410,7 +410,7 @@ struct Wal {
|
||||
u32 iCallback; /* Value to pass to log callback (or 0) */
|
||||
int nWiData; /* Size of array apWiData */
|
||||
volatile u32 **apWiData; /* Pointer to wal-index content in memory */
|
||||
u16 szPage; /* Database page size */
|
||||
u32 szPage; /* Database page size */
|
||||
i16 readLock; /* Which read lock is being held. -1 for none */
|
||||
u8 exclusiveMode; /* Non-zero if connection is in exclusive mode */
|
||||
u8 writeLock; /* True if in a write transaction */
|
||||
@@ -1081,7 +1081,7 @@ static int walIndexRecover(Wal *pWal){
|
||||
goto finished;
|
||||
}
|
||||
pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);
|
||||
pWal->szPage = (u16)szPage;
|
||||
pWal->szPage = szPage;
|
||||
pWal->nCkpt = sqlite3Get4byte(&aBuf[12]);
|
||||
memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
|
||||
|
||||
@@ -1131,7 +1131,7 @@ static int walIndexRecover(Wal *pWal){
|
||||
if( nTruncate ){
|
||||
pWal->hdr.mxFrame = iFrame;
|
||||
pWal->hdr.nPage = nTruncate;
|
||||
pWal->hdr.szPage = (u16)szPage;
|
||||
pWal->hdr.szPage = (szPage>=0x10000) ? (szPage>>16) : szPage;
|
||||
aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
|
||||
aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
|
||||
}
|
||||
@@ -1516,7 +1516,7 @@ static int walCheckpoint(
|
||||
u8 *zBuf /* Temporary buffer to use */
|
||||
){
|
||||
int rc; /* Return code */
|
||||
int szPage = pWal->hdr.szPage; /* Database page-size */
|
||||
int szPage; /* Database page-size */
|
||||
WalIterator *pIter = 0; /* Wal iterator context */
|
||||
u32 iDbpage = 0; /* Next database page to write */
|
||||
u32 iFrame = 0; /* Wal frame containing data for iDbpage */
|
||||
@@ -1525,6 +1525,8 @@ static int walCheckpoint(
|
||||
int i; /* Loop counter */
|
||||
volatile WalCkptInfo *pInfo; /* The checkpoint status information */
|
||||
|
||||
szPage = pWal->hdr.szPage;
|
||||
if( szPage<512 ) szPage <<= 16;
|
||||
if( pWal->hdr.mxFrame==0 ) return SQLITE_OK;
|
||||
|
||||
/* Allocate the iterator */
|
||||
@@ -1535,7 +1537,7 @@ static int walCheckpoint(
|
||||
assert( pIter );
|
||||
|
||||
/*** TODO: Move this test out to the caller. Make it an assert() here ***/
|
||||
if( pWal->hdr.szPage!=nBuf ){
|
||||
if( szPage!=nBuf ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto walcheckpoint_out;
|
||||
}
|
||||
@@ -1727,6 +1729,7 @@ static int walIndexTryHdr(Wal *pWal, int *pChanged){
|
||||
*pChanged = 1;
|
||||
memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));
|
||||
pWal->szPage = pWal->hdr.szPage;
|
||||
if( pWal->szPage<512 ) pWal->szPage <<= 16;
|
||||
}
|
||||
|
||||
/* The header was successfully read. Return zero. */
|
||||
@@ -2156,7 +2159,11 @@ int sqlite3WalRead(
|
||||
** required page. Read and return data from the log file.
|
||||
*/
|
||||
if( iRead ){
|
||||
i64 iOffset = walFrameOffset(iRead, pWal->hdr.szPage) + WAL_FRAME_HDRSIZE;
|
||||
int sz;
|
||||
i64 iOffset;
|
||||
sz = pWal->hdr.szPage;
|
||||
if( sz<512 ) sz <<= 16;
|
||||
iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE;
|
||||
*pInWal = 1;
|
||||
/* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */
|
||||
return sqlite3OsRead(pWal->pWalFd, pOut, nOut, iOffset);
|
||||
@@ -2439,7 +2446,7 @@ int sqlite3WalFrames(
|
||||
sqlite3Put4byte(&aWalHdr[24], aCksum[0]);
|
||||
sqlite3Put4byte(&aWalHdr[28], aCksum[1]);
|
||||
|
||||
pWal->szPage = (u16)szPage;
|
||||
pWal->szPage = szPage;
|
||||
pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;
|
||||
pWal->hdr.aFrameCksum[0] = aCksum[0];
|
||||
pWal->hdr.aFrameCksum[1] = aCksum[1];
|
||||
@@ -2534,7 +2541,7 @@ int sqlite3WalFrames(
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
/* Update the private copy of the header. */
|
||||
pWal->hdr.szPage = (u16)szPage;
|
||||
pWal->hdr.szPage = szPage>=0x10000 ? (szPage >> 16) : szPage;
|
||||
pWal->hdr.mxFrame = iFrame;
|
||||
if( isCommit ){
|
||||
pWal->hdr.iChange++;
|
||||
|
||||
Reference in New Issue
Block a user