mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Enable the b-tree cursor objects overflow page-number cache, which is normally enabled only for incr-blob cursors, for all cursors.
FossilOrigin-Name: da59198505990a4fe832be7932117c7e014955b7
This commit is contained in:
26
manifest
26
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Version\s3.8.4.1
|
C Enable\sthe\sb-tree\scursor\sobjects\soverflow\spage-number\scache,\swhich\sis\snormally\senabled\sonly\sfor\sincr-blob\scursors,\sfor\sall\scursors.
|
||||||
D 2014-03-11T15:27:36.923
|
D 2014-03-11T20:33:04.219
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -164,9 +164,9 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
|||||||
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
|
F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
|
||||||
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
||||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||||
F src/btree.c 4d28fb15543f0e071b1780b2af8cd2ee489de32d
|
F src/btree.c c748d8387789d01769e442b9da65e52ed61f408e
|
||||||
F src/btree.h 9e0f97c01b972f779eb7655cfb4f8727fd6dc26f
|
F src/btree.h 6b0c1a3f0937f9852ec727c820e71dbdd4bd0b27
|
||||||
F src/btreeInt.h 0be66063468a520e4d66b80c7a1dc26d04ee6ea4
|
F src/btreeInt.h 22a8f07968ec821910ab93cc822d7f0c404c74d1
|
||||||
F src/build.c 0d50ef95aad63f4c4fc47f3fa2670d4557c45db0
|
F src/build.c 0d50ef95aad63f4c4fc47f3fa2670d4557c45db0
|
||||||
F src/callback.c 174e3c8656bc29f91d710ab61550d16eea34be98
|
F src/callback.c 174e3c8656bc29f91d710ab61550d16eea34be98
|
||||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||||
@@ -283,7 +283,7 @@ F src/vdbe.h fb2c48c198300a7c632f09fc940011d2ad2fc2ae
|
|||||||
F src/vdbeInt.h e54fc4f289fce48e81b3371128446033d097733b
|
F src/vdbeInt.h e54fc4f289fce48e81b3371128446033d097733b
|
||||||
F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4
|
F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4
|
||||||
F src/vdbeaux.c e45e3f9daf38c5be3fd39e9aacc1c9066af57a06
|
F src/vdbeaux.c e45e3f9daf38c5be3fd39e9aacc1c9066af57a06
|
||||||
F src/vdbeblob.c 15377abfb59251bccedd5a9c7d014a895f0c04aa
|
F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac
|
||||||
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
|
F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447
|
||||||
F src/vdbesort.c 46801acb342e5e4c07ba1777fe58880c143abb59
|
F src/vdbesort.c 46801acb342e5e4c07ba1777fe58880c143abb59
|
||||||
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
|
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
|
||||||
@@ -1156,10 +1156,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||||
P 33f5694fa42d9a521ca081de4ddd1e9dc8952b16
|
P 018d317b1257ce68a92908b05c9c7cf1494050d0
|
||||||
R 581994aed374f15c1c6bac5b0a9a5df5
|
R 9660042129e37a760044c3b5edf13974
|
||||||
T +bgcolor * #d0c0ff
|
T *branch * overflow-pgno-cache
|
||||||
T +sym-release *
|
T *sym-overflow-pgno-cache *
|
||||||
T +sym-version-3.8.4.1 *
|
T -sym-trunk *
|
||||||
U drh
|
U dan
|
||||||
Z c1ec45dc8a92b80bfa16f4c74ccfeec8
|
Z 262878375cf61ff20b91f83b47f52bc2
|
||||||
|
@@ -1 +1 @@
|
|||||||
018d317b1257ce68a92908b05c9c7cf1494050d0
|
da59198505990a4fe832be7932117c7e014955b7
|
96
src/btree.c
96
src/btree.c
@@ -446,16 +446,11 @@ static int cursorHoldsMutex(BtCursor *p){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef SQLITE_OMIT_INCRBLOB
|
|
||||||
/*
|
/*
|
||||||
** Invalidate the overflow page-list cache for cursor pCur, if any.
|
** Invalidate the overflow cache of the cursor passed as the first argument.
|
||||||
|
** on the shared btree structure pBt.
|
||||||
*/
|
*/
|
||||||
static void invalidateOverflowCache(BtCursor *pCur){
|
#define invalidateOverflowCache(pCur) (pCur->bOvflValid = 0)
|
||||||
assert( cursorHoldsMutex(pCur) );
|
|
||||||
sqlite3_free(pCur->aOverflow);
|
|
||||||
pCur->aOverflow = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Invalidate the overflow page-list cache for all cursors opened
|
** Invalidate the overflow page-list cache for all cursors opened
|
||||||
@@ -469,6 +464,7 @@ static void invalidateAllOverflowCache(BtShared *pBt){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SQLITE_OMIT_INCRBLOB
|
||||||
/*
|
/*
|
||||||
** This function is called before modifying the contents of a table
|
** This function is called before modifying the contents of a table
|
||||||
** to invalidate any incrblob cursors that are open on the
|
** to invalidate any incrblob cursors that are open on the
|
||||||
@@ -498,9 +494,7 @@ static void invalidateIncrblobCursors(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Stub functions when INCRBLOB is omitted */
|
/* Stub function when INCRBLOB is omitted */
|
||||||
#define invalidateOverflowCache(x)
|
|
||||||
#define invalidateAllOverflowCache(x)
|
|
||||||
#define invalidateIncrblobCursors(x,y,z)
|
#define invalidateIncrblobCursors(x,y,z)
|
||||||
#endif /* SQLITE_OMIT_INCRBLOB */
|
#endif /* SQLITE_OMIT_INCRBLOB */
|
||||||
|
|
||||||
@@ -3694,7 +3688,7 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){
|
|||||||
releasePage(pCur->apPage[i]);
|
releasePage(pCur->apPage[i]);
|
||||||
}
|
}
|
||||||
unlockBtreeIfUnused(pBt);
|
unlockBtreeIfUnused(pBt);
|
||||||
invalidateOverflowCache(pCur);
|
sqlite3DbFree(pBtree->db, pCur->aOverflow);
|
||||||
/* sqlite3_free(pCur); */
|
/* sqlite3_free(pCur); */
|
||||||
sqlite3BtreeLeave(pBtree);
|
sqlite3BtreeLeave(pBtree);
|
||||||
}
|
}
|
||||||
@@ -3915,10 +3909,12 @@ static int copyPayload(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
** This function is used to read or overwrite payload information
|
** This function is used to read or overwrite payload information
|
||||||
** for the entry that the pCur cursor is pointing to. If the eOp
|
** for the entry that the pCur cursor is pointing to. The eOp
|
||||||
** parameter is 0, this is a read operation (data copied into
|
** argument is interpreted as follows:
|
||||||
** buffer pBuf). If it is non-zero, a write (data copied from
|
**
|
||||||
** buffer pBuf).
|
** 0: The operation is a read. Populate the overflow cache.
|
||||||
|
** 1: The operation is a write. Populate the overflow cache.
|
||||||
|
** 2: The operation is a read. Do not populate the overflow cache.
|
||||||
**
|
**
|
||||||
** A total of "amt" bytes are read or written beginning at "offset".
|
** A total of "amt" bytes are read or written beginning at "offset".
|
||||||
** Data is read to or from the buffer pBuf.
|
** Data is read to or from the buffer pBuf.
|
||||||
@@ -3926,11 +3922,11 @@ static int copyPayload(
|
|||||||
** The content being read or written might appear on the main page
|
** The content being read or written might appear on the main page
|
||||||
** or be scattered out on multiple overflow pages.
|
** or be scattered out on multiple overflow pages.
|
||||||
**
|
**
|
||||||
** If the BtCursor.isIncrblobHandle flag is set, and the current
|
** If the current cursor entry uses one or more overflow pages and the
|
||||||
** cursor entry uses one or more overflow pages, this function
|
** eOp argument is not 2, this function may allocate space for and lazily
|
||||||
** allocates space for and lazily popluates the overflow page-list
|
** popluates the overflow page-list cache array (BtCursor.aOverflow).
|
||||||
** cache array (BtCursor.aOverflow). Subsequent calls use this
|
** Subsequent calls use this cache to make seeking to the supplied offset
|
||||||
** cache to make seeking to the supplied offset more efficient.
|
** more efficient.
|
||||||
**
|
**
|
||||||
** Once an overflow page-list cache has been allocated, it may be
|
** Once an overflow page-list cache has been allocated, it may be
|
||||||
** invalidated if some other cursor writes to the same table, or if
|
** invalidated if some other cursor writes to the same table, or if
|
||||||
@@ -3977,7 +3973,7 @@ static int accessPayload(
|
|||||||
if( a+offset>pCur->info.nLocal ){
|
if( a+offset>pCur->info.nLocal ){
|
||||||
a = pCur->info.nLocal - offset;
|
a = pCur->info.nLocal - offset;
|
||||||
}
|
}
|
||||||
rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage);
|
rc = copyPayload(&aPayload[offset], pBuf, a, (eOp & 0x01), pPage->pDbPage);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
pBuf += a;
|
pBuf += a;
|
||||||
amt -= a;
|
amt -= a;
|
||||||
@@ -3991,7 +3987,6 @@ static int accessPayload(
|
|||||||
|
|
||||||
nextPage = get4byte(&aPayload[pCur->info.nLocal]);
|
nextPage = get4byte(&aPayload[pCur->info.nLocal]);
|
||||||
|
|
||||||
#ifndef SQLITE_OMIT_INCRBLOB
|
|
||||||
/* If the isIncrblobHandle flag is set and the BtCursor.aOverflow[]
|
/* If the isIncrblobHandle flag is set and the BtCursor.aOverflow[]
|
||||||
** has not been allocated, allocate it now. The array is sized at
|
** has not been allocated, allocate it now. The array is sized at
|
||||||
** one entry for each overflow page in the overflow chain. The
|
** one entry for each overflow page in the overflow chain. The
|
||||||
@@ -3999,13 +3994,22 @@ static int accessPayload(
|
|||||||
** etc. A value of 0 in the aOverflow[] array means "not yet known"
|
** etc. A value of 0 in the aOverflow[] array means "not yet known"
|
||||||
** (the cache is lazily populated).
|
** (the cache is lazily populated).
|
||||||
*/
|
*/
|
||||||
if( pCur->isIncrblobHandle && !pCur->aOverflow ){
|
if( eOp!=2 && !pCur->bOvflValid ){
|
||||||
int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;
|
int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;
|
||||||
pCur->aOverflow = (Pgno *)sqlite3MallocZero(sizeof(Pgno)*nOvfl);
|
if( nOvfl>pCur->nOvflAlloc ){
|
||||||
/* nOvfl is always positive. If it were zero, fetchPayload would have
|
Pgno *aNew = (Pgno*)sqlite3DbRealloc(
|
||||||
** been used instead of this routine. */
|
pCur->pBtree->db, pCur->aOverflow, nOvfl*2*sizeof(Pgno)
|
||||||
if( ALWAYS(nOvfl) && !pCur->aOverflow ){
|
);
|
||||||
|
if( aNew==0 ){
|
||||||
rc = SQLITE_NOMEM;
|
rc = SQLITE_NOMEM;
|
||||||
|
}else{
|
||||||
|
pCur->nOvflAlloc = nOvfl*2;
|
||||||
|
pCur->aOverflow = aNew;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( rc==SQLITE_OK ){
|
||||||
|
memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
|
||||||
|
pCur->bOvflValid = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4013,22 +4017,19 @@ static int accessPayload(
|
|||||||
** entry for the first required overflow page is valid, skip
|
** entry for the first required overflow page is valid, skip
|
||||||
** directly to it.
|
** directly to it.
|
||||||
*/
|
*/
|
||||||
if( pCur->aOverflow && pCur->aOverflow[offset/ovflSize] ){
|
if( pCur->bOvflValid && pCur->aOverflow[offset/ovflSize] ){
|
||||||
iIdx = (offset/ovflSize);
|
iIdx = (offset/ovflSize);
|
||||||
nextPage = pCur->aOverflow[iIdx];
|
nextPage = pCur->aOverflow[iIdx];
|
||||||
offset = (offset%ovflSize);
|
offset = (offset%ovflSize);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){
|
for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){
|
||||||
|
|
||||||
#ifndef SQLITE_OMIT_INCRBLOB
|
|
||||||
/* If required, populate the overflow page-list cache. */
|
/* If required, populate the overflow page-list cache. */
|
||||||
if( pCur->aOverflow ){
|
if( pCur->bOvflValid ){
|
||||||
assert(!pCur->aOverflow[iIdx] || pCur->aOverflow[iIdx]==nextPage);
|
assert(!pCur->aOverflow[iIdx] || pCur->aOverflow[iIdx]==nextPage);
|
||||||
pCur->aOverflow[iIdx] = nextPage;
|
pCur->aOverflow[iIdx] = nextPage;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if( offset>=ovflSize ){
|
if( offset>=ovflSize ){
|
||||||
/* The only reason to read this page is to obtain the page
|
/* The only reason to read this page is to obtain the page
|
||||||
@@ -4037,11 +4038,9 @@ static int accessPayload(
|
|||||||
** page-list cache, if any, then fall back to the getOverflowPage()
|
** page-list cache, if any, then fall back to the getOverflowPage()
|
||||||
** function.
|
** function.
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_INCRBLOB
|
if( pCur->bOvflValid && pCur->aOverflow[iIdx+1] ){
|
||||||
if( pCur->aOverflow && pCur->aOverflow[iIdx+1] ){
|
|
||||||
nextPage = pCur->aOverflow[iIdx+1];
|
nextPage = pCur->aOverflow[iIdx+1];
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
rc = getOverflowPage(pBt, nextPage, 0, &nextPage);
|
rc = getOverflowPage(pBt, nextPage, 0, &nextPage);
|
||||||
offset -= ovflSize;
|
offset -= ovflSize;
|
||||||
}else{
|
}else{
|
||||||
@@ -4069,7 +4068,7 @@ static int accessPayload(
|
|||||||
** output buffer, bypassing the page-cache altogether. This speeds
|
** output buffer, bypassing the page-cache altogether. This speeds
|
||||||
** up loading large records that span many overflow pages.
|
** up loading large records that span many overflow pages.
|
||||||
*/
|
*/
|
||||||
if( eOp==0 /* (1) */
|
if( (eOp&0x01)==0 /* (1) */
|
||||||
&& offset==0 /* (2) */
|
&& offset==0 /* (2) */
|
||||||
&& pBt->inTransaction==TRANS_READ /* (4) */
|
&& pBt->inTransaction==TRANS_READ /* (4) */
|
||||||
&& (fd = sqlite3PagerFile(pBt->pPager))->pMethods /* (3) */
|
&& (fd = sqlite3PagerFile(pBt->pPager))->pMethods /* (3) */
|
||||||
@@ -4087,12 +4086,12 @@ static int accessPayload(
|
|||||||
{
|
{
|
||||||
DbPage *pDbPage;
|
DbPage *pDbPage;
|
||||||
rc = sqlite3PagerAcquire(pBt->pPager, nextPage, &pDbPage,
|
rc = sqlite3PagerAcquire(pBt->pPager, nextPage, &pDbPage,
|
||||||
(eOp==0 ? PAGER_GET_READONLY : 0)
|
((eOp&0x01)==0 ? PAGER_GET_READONLY : 0)
|
||||||
);
|
);
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
aPayload = sqlite3PagerGetData(pDbPage);
|
aPayload = sqlite3PagerGetData(pDbPage);
|
||||||
nextPage = get4byte(aPayload);
|
nextPage = get4byte(aPayload);
|
||||||
rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage);
|
rc = copyPayload(&aPayload[offset+4], pBuf, a, (eOp&0x01), pDbPage);
|
||||||
sqlite3PagerUnref(pDbPage);
|
sqlite3PagerUnref(pDbPage);
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
@@ -4337,6 +4336,7 @@ static int moveToRoot(BtCursor *pCur){
|
|||||||
assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );
|
assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );
|
||||||
assert( CURSOR_VALID < CURSOR_REQUIRESEEK );
|
assert( CURSOR_VALID < CURSOR_REQUIRESEEK );
|
||||||
assert( CURSOR_FAULT > CURSOR_REQUIRESEEK );
|
assert( CURSOR_FAULT > CURSOR_REQUIRESEEK );
|
||||||
|
invalidateOverflowCache(pCur);
|
||||||
if( pCur->eState>=CURSOR_REQUIRESEEK ){
|
if( pCur->eState>=CURSOR_REQUIRESEEK ){
|
||||||
if( pCur->eState==CURSOR_FAULT ){
|
if( pCur->eState==CURSOR_FAULT ){
|
||||||
assert( pCur->skipNext!=SQLITE_OK );
|
assert( pCur->skipNext!=SQLITE_OK );
|
||||||
@@ -4686,7 +4686,7 @@ int sqlite3BtreeMovetoUnpacked(
|
|||||||
goto moveto_finish;
|
goto moveto_finish;
|
||||||
}
|
}
|
||||||
pCur->aiIdx[pCur->iPage] = (u16)idx;
|
pCur->aiIdx[pCur->iPage] = (u16)idx;
|
||||||
rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0);
|
rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 2);
|
||||||
if( rc ){
|
if( rc ){
|
||||||
sqlite3_free(pCellKey);
|
sqlite3_free(pCellKey);
|
||||||
goto moveto_finish;
|
goto moveto_finish;
|
||||||
@@ -4775,6 +4775,7 @@ int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
|
|||||||
assert( pRes!=0 );
|
assert( pRes!=0 );
|
||||||
assert( *pRes==0 || *pRes==1 );
|
assert( *pRes==0 || *pRes==1 );
|
||||||
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
|
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
|
||||||
|
invalidateOverflowCache(pCur);
|
||||||
if( pCur->eState!=CURSOR_VALID ){
|
if( pCur->eState!=CURSOR_VALID ){
|
||||||
rc = restoreCursorPosition(pCur);
|
rc = restoreCursorPosition(pCur);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
@@ -4870,6 +4871,7 @@ int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
|
|||||||
assert( pRes!=0 );
|
assert( pRes!=0 );
|
||||||
assert( *pRes==0 || *pRes==1 );
|
assert( *pRes==0 || *pRes==1 );
|
||||||
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
|
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
|
||||||
|
invalidateOverflowCache(pCur);
|
||||||
pCur->atLast = 0;
|
pCur->atLast = 0;
|
||||||
if( pCur->eState!=CURSOR_VALID ){
|
if( pCur->eState!=CURSOR_VALID ){
|
||||||
if( ALWAYS(pCur->eState>=CURSOR_REQUIRESEEK) ){
|
if( ALWAYS(pCur->eState>=CURSOR_REQUIRESEEK) ){
|
||||||
@@ -8424,19 +8426,9 @@ int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Set a flag on this cursor to cache the locations of pages from the
|
** Mark this cursor as an incremental blob cursor.
|
||||||
** overflow list for the current row. This is used by cursors opened
|
|
||||||
** for incremental blob IO only.
|
|
||||||
**
|
|
||||||
** This function sets a flag only. The actual page location cache
|
|
||||||
** (stored in BtCursor.aOverflow[]) is allocated and used by function
|
|
||||||
** accessPayload() (the worker function for sqlite3BtreeData() and
|
|
||||||
** sqlite3BtreePutData()).
|
|
||||||
*/
|
*/
|
||||||
void sqlite3BtreeCacheOverflow(BtCursor *pCur){
|
void sqlite3BtreeIncrblobCursor(BtCursor *pCur){
|
||||||
assert( cursorHoldsMutex(pCur) );
|
|
||||||
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
|
|
||||||
invalidateOverflowCache(pCur);
|
|
||||||
pCur->isIncrblobHandle = 1;
|
pCur->isIncrblobHandle = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -187,7 +187,7 @@ char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
|
|||||||
struct Pager *sqlite3BtreePager(Btree*);
|
struct Pager *sqlite3BtreePager(Btree*);
|
||||||
|
|
||||||
int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
|
int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
|
||||||
void sqlite3BtreeCacheOverflow(BtCursor *);
|
void sqlite3BtreeIncrblobCursor(BtCursor *);
|
||||||
void sqlite3BtreeClearCursor(BtCursor *);
|
void sqlite3BtreeClearCursor(BtCursor *);
|
||||||
int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
|
int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
|
||||||
void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
|
void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
|
||||||
|
@@ -497,6 +497,8 @@ struct BtCursor {
|
|||||||
BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
|
BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */
|
||||||
struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
|
struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
|
||||||
#ifndef SQLITE_OMIT_INCRBLOB
|
#ifndef SQLITE_OMIT_INCRBLOB
|
||||||
|
int nOvflAlloc; /* Allocated size of aOverflow[] array */
|
||||||
|
u8 bOvflValid; /* True if size and contents of aOverflow[] valid */
|
||||||
Pgno *aOverflow; /* Cache of overflow page locations */
|
Pgno *aOverflow; /* Cache of overflow page locations */
|
||||||
#endif
|
#endif
|
||||||
Pgno pgnoRoot; /* The root page of this tree */
|
Pgno pgnoRoot; /* The root page of this tree */
|
||||||
|
@@ -77,9 +77,7 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
|
|||||||
p->iOffset = pC->aType[p->iCol + pC->nField];
|
p->iOffset = pC->aType[p->iCol + pC->nField];
|
||||||
p->nByte = sqlite3VdbeSerialTypeLen(type);
|
p->nByte = sqlite3VdbeSerialTypeLen(type);
|
||||||
p->pCsr = pC->pCursor;
|
p->pCsr = pC->pCursor;
|
||||||
sqlite3BtreeEnterCursor(p->pCsr);
|
sqlite3BtreeIncrblobCursor(p->pCsr);
|
||||||
sqlite3BtreeCacheOverflow(p->pCsr);
|
|
||||||
sqlite3BtreeLeaveCursor(p->pCsr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user