Fix some OOM-handling issues in the fts5 changes on this branch.
FossilOrigin-Name: 020a0bda59fe93b9361ceeed0d5a8ba4177380c8
This commit is contained in:
parent
db8d320d63
commit
c9460ab989
@ -990,17 +990,19 @@ static Fts5Structure *fts5StructureReadUncached(Fts5Index *p){
|
||||
static i64 fts5IndexDataVersion(Fts5Index *p){
|
||||
i64 iVersion = 0;
|
||||
|
||||
if( p->pDataVersion==0 ){
|
||||
p->rc = fts5IndexPrepareStmt(p, &p->pDataVersion,
|
||||
sqlite3_mprintf("PRAGMA %Q.data_version", p->pConfig->zDb)
|
||||
);
|
||||
if( p->rc ) return 0;
|
||||
}
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( p->pDataVersion==0 ){
|
||||
p->rc = fts5IndexPrepareStmt(p, &p->pDataVersion,
|
||||
sqlite3_mprintf("PRAGMA %Q.data_version", p->pConfig->zDb)
|
||||
);
|
||||
if( p->rc ) return 0;
|
||||
}
|
||||
|
||||
if( SQLITE_ROW==sqlite3_step(p->pDataVersion) ){
|
||||
iVersion = sqlite3_column_int64(p->pDataVersion, 0);
|
||||
if( SQLITE_ROW==sqlite3_step(p->pDataVersion) ){
|
||||
iVersion = sqlite3_column_int64(p->pDataVersion, 0);
|
||||
}
|
||||
p->rc = sqlite3_reset(p->pDataVersion);
|
||||
}
|
||||
p->rc = sqlite3_reset(p->pDataVersion);
|
||||
|
||||
return iVersion;
|
||||
}
|
||||
@ -1019,39 +1021,40 @@ static i64 fts5IndexDataVersion(Fts5Index *p){
|
||||
static Fts5Structure *fts5StructureRead(Fts5Index *p){
|
||||
Fts5Structure *pRet; /* Object to return */
|
||||
|
||||
if( p->pStruct ){
|
||||
pRet = p->pStruct;
|
||||
#ifdef SQLITE_DEBUG
|
||||
{
|
||||
Fts5Structure *pTest = fts5StructureReadUncached(p);
|
||||
if( pTest ){
|
||||
int i, j;
|
||||
assert_nc( pRet->nSegment==pTest->nSegment );
|
||||
assert_nc( pRet->nLevel==pTest->nLevel );
|
||||
for(i=0; i<pTest->nLevel; i++){
|
||||
assert_nc( pRet->aLevel[i].nMerge==pTest->aLevel[i].nMerge );
|
||||
assert_nc( pRet->aLevel[i].nSeg==pTest->aLevel[i].nSeg );
|
||||
for(j=0; j<pTest->aLevel[i].nSeg; j++){
|
||||
Fts5StructureSegment *p1 = &pTest->aLevel[i].aSeg[j];
|
||||
Fts5StructureSegment *p2 = &pRet->aLevel[i].aSeg[j];
|
||||
assert_nc( p1->iSegid==p2->iSegid );
|
||||
assert_nc( p1->pgnoFirst==p2->pgnoFirst );
|
||||
assert_nc( p1->pgnoLast==p2->pgnoLast );
|
||||
}
|
||||
}
|
||||
fts5StructureRelease(pTest);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}else{
|
||||
pRet = fts5StructureReadUncached(p);
|
||||
}
|
||||
|
||||
if( pRet ){
|
||||
fts5StructureRef(pRet);
|
||||
p->pStruct = pRet;
|
||||
if( p->pStruct==0 ){
|
||||
p->iStructVersion = fts5IndexDataVersion(p);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
p->pStruct = pRet = fts5StructureReadUncached(p);
|
||||
}
|
||||
if( p->rc!=SQLITE_OK ) return 0;
|
||||
assert( p->iStructVersion!=0 );
|
||||
assert( p->pStruct!=0 );
|
||||
}
|
||||
#ifdef SQLITE_DEBUG
|
||||
else{
|
||||
Fts5Structure *pTest = fts5StructureReadUncached(p);
|
||||
if( pTest ){
|
||||
int i, j;
|
||||
assert_nc( p->pStruct->nSegment==pTest->nSegment );
|
||||
assert_nc( p->pStruct->nLevel==pTest->nLevel );
|
||||
for(i=0; i<pTest->nLevel; i++){
|
||||
assert_nc( p->pStruct->aLevel[i].nMerge==pTest->aLevel[i].nMerge );
|
||||
assert_nc( p->pStruct->aLevel[i].nSeg==pTest->aLevel[i].nSeg );
|
||||
for(j=0; j<pTest->aLevel[i].nSeg; j++){
|
||||
Fts5StructureSegment *p1 = &pTest->aLevel[i].aSeg[j];
|
||||
Fts5StructureSegment *p2 = &p->pStruct->aLevel[i].aSeg[j];
|
||||
assert_nc( p1->iSegid==p2->iSegid );
|
||||
assert_nc( p1->pgnoFirst==p2->pgnoFirst );
|
||||
assert_nc( p1->pgnoLast==p2->pgnoLast );
|
||||
}
|
||||
}
|
||||
fts5StructureRelease(pTest);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pRet = p->pStruct;
|
||||
fts5StructureRef(pRet);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\sthe\schanges\son\sthe\sreusable-pragma\sbranch\sinto\sthis\sone.
|
||||
D 2016-03-16T20:53:33.830
|
||||
C Fix\ssome\sOOM-handling\sissues\sin\sthe\sfts5\schanges\son\sthis\sbranch.
|
||||
D 2016-03-17T12:39:56.371
|
||||
F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66
|
||||
@ -104,7 +104,7 @@ F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd
|
||||
F ext/fts5/fts5_config.c 5af9c360e99669d29f06492c370892394aba0857
|
||||
F ext/fts5/fts5_expr.c 35e9d92c89e7c7ea0759b73d24da1ecb7630a24b
|
||||
F ext/fts5/fts5_hash.c f3a7217c86eb8f272871be5f6aa1b6798960a337
|
||||
F ext/fts5/fts5_index.c 317040cb17cdad05e973376b39239b29c75f90b5
|
||||
F ext/fts5/fts5_index.c afac2ffe3198776626b99366e18af1f32ea9eb85
|
||||
F ext/fts5/fts5_main.c b4a0fc5bf17f2f1f056ee76cdd7d2af08b360f55
|
||||
F ext/fts5/fts5_storage.c a3361410422e69639ca2bcd5a56a0933dadf84d2
|
||||
F ext/fts5/fts5_tcl.c f8731e0508299bd43f1a2eff7dbeaac870768966
|
||||
@ -1456,7 +1456,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 33ef2210ef19e55c8d460bfe9d3dc146034c8acc db1ce7e13e656fcd2766f1b1f225cbfefe8f73ad
|
||||
R 9bcd2375f3bee3eec21a0e0d6e512aed
|
||||
P 6c4a17b963916d19c9433d7a251338042f32e9fa
|
||||
R bc1955b591517ca84e5bb3a7a87f0726
|
||||
U dan
|
||||
Z 9f0b8bb8494a2ee2e21e8a8509116058
|
||||
Z 380059b0b3811052efb55863df364c4f
|
||||
|
@ -1 +1 @@
|
||||
6c4a17b963916d19c9433d7a251338042f32e9fa
|
||||
020a0bda59fe93b9361ceeed0d5a8ba4177380c8
|
Loading…
Reference in New Issue
Block a user