1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Additional schema mutex checks for sqlite3RootPageMoved().

Reduce the scope of sqlite3ResetInternalSchema() in a few places.

FossilOrigin-Name: 39c00907833413c0d97d3e06fdda967b825d23ea
This commit is contained in:
drh
2011-04-04 21:25:28 +00:00
parent 9bbc2e283e
commit cdf011dcc4
6 changed files with 23 additions and 22 deletions

View File

@@ -551,7 +551,7 @@ int sqlite3VdbeExec(
Op *pOp; /* Current operation */
int rc = SQLITE_OK; /* Value to return */
sqlite3 *db = p->db; /* The database */
u8 resetSchemaOnFault = 0; /* Reset schema after an error if true */
u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */
u8 encoding = ENC(db); /* The database encoding */
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
int checkProgress; /* True if progress callbacks are enabled */
@@ -2953,7 +2953,6 @@ case OP_VerifyCookie: {
*/
if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
sqlite3ResetInternalSchema(db, pOp->p1);
sqlite3VdbeMutexResync(p);
}
p->expired = 1;
@@ -4534,8 +4533,10 @@ case OP_Destroy: { /* out2-prerelease */
pOut->u.i = iMoved;
#ifndef SQLITE_OMIT_AUTOVACUUM
if( rc==SQLITE_OK && iMoved!=0 ){
sqlite3RootPageMoved(&db->aDb[iDb], iMoved, pOp->p1);
resetSchemaOnFault = 1;
sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1);
/* All OP_Destroy operations occur on the same btree */
assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 );
resetSchemaOnFault = iDb+1;
}
#endif
}
@@ -5969,9 +5970,8 @@ vdbe_error_halt:
sqlite3VdbeHalt(p);
if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1;
rc = SQLITE_ERROR;
if( resetSchemaOnFault ){
sqlite3ResetInternalSchema(db, 0);
sqlite3VdbeMutexResync(p);
if( resetSchemaOnFault>0 ){
sqlite3ResetInternalSchema(db, resetSchemaOnFault-1);
}
/* This is the only way out of this procedure. We have to