/ Check-in [d8b46290]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add an assert() to ensure that schema mutexes are held prior to accessing the DB_SchemaLoaded flag inside of sqlite3Init().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d8b46290bb75c695dac523cf9a50d1b43e773802e3b95fd722feca16162ab7c5
User & Date: drh 2018-04-25 10:30:46
Context
2018-04-25
12:01
Avoid many unnecessary calls to sqlite3ReadSchema() and sqlite3Init() when the schema is known to be valid already. check-in: 58cf812f user: drh tags: trunk
10:30
Add an assert() to ensure that schema mutexes are held prior to accessing the DB_SchemaLoaded flag inside of sqlite3Init(). check-in: d8b46290 user: drh tags: trunk
2018-04-24
18:59
Remove a recently added NEVER() macro from a branch that can be taken in obscure circumstances. check-in: 2aa21003 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/prepare.c.

   370    370     /* Do the main schema first */
   371    371     if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){
   372    372       rc = sqlite3InitOne(db, 0, pzErrMsg);
   373    373       if( rc ) return rc;
   374    374     }
   375    375     /* All other schemas after the main schema. The "temp" schema must be last */
   376    376     for(i=db->nDb-1; i>0; i--){
          377  +    assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) );
   377    378       if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
   378    379         rc = sqlite3InitOne(db, i, pzErrMsg);
   379    380         if( rc ) return rc;
   380    381       }
   381    382     }
   382    383     if( commit_internal ){
   383    384       sqlite3CommitInternalChanges(db);