SQLite

Check-in [d8b46290bb]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d8b46290bb75c695dac523cf9a50d1b43e773802e3b95fd722feca16162ab7c5
User & Date: drh 2018-04-25 10:30:46.214
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: 58cf812fd8 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: d8b46290bb 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: 2aa210030a user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/prepare.c.
370
371
372
373
374
375
376

377
378
379
380
381
382
383
  /* Do the main schema first */
  if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){
    rc = sqlite3InitOne(db, 0, pzErrMsg);
    if( rc ) return rc;
  }
  /* All other schemas after the main schema. The "temp" schema must be last */
  for(i=db->nDb-1; i>0; i--){

    if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
      rc = sqlite3InitOne(db, i, pzErrMsg);
      if( rc ) return rc;
    }
  }
  if( commit_internal ){
    sqlite3CommitInternalChanges(db);







>







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