SQLite

Check-in [7ed3346e8c]
Login

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

Overview
Comment:The KeyInfo cache must be cleared before closing the btree, not after. Revised fix for ticket [e4a18565a36884b00edf].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ed3346e8c10dbf52fd44ab69900699d4f7ad3fd
User & Date: drh 2014-12-05 15:31:33.761
Context
2014-12-05
19:50
Make sure the WhereTerm objects are fully zeroed when they are allocated. (check-in: fdb667335c user: drh tags: trunk)
15:31
The KeyInfo cache must be cleared before closing the btree, not after. Revised fix for ticket [e4a18565a36884b00edf]. (check-in: 7ed3346e8c user: drh tags: trunk)
15:25
The KeyInfo cache must be cleared before closing the btree, not after. Revised fix for ticket [e4a18565a36884b00edf]. (check-in: 48529508cf user: drh tags: branch-3.8.7)
14:44
When closing a (shared-cache) database connection, be sure to clear out all KeyInfo objects cached on Index objects. Fix for ticket [e4a18565a36884b00edf]. (check-in: adca7688de user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043




1044
1045
1046
1047
1048
1049
1050
  /* Free any outstanding Savepoint structures. */
  sqlite3CloseSavepoints(db);

  /* Close all database connections */
  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 && pDb->pSchema ){
        /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */
        for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
          Index *pIdx = sqliteHashData(i);
          sqlite3KeyInfoUnref(pIdx->pKeyInfo);
          pIdx->pKeyInfo = 0;
        }




        pDb->pSchema = 0;
      }
    }
  }
  /* Clear the TEMP schema separately and last */
  if( db->aDb[1].pSchema ){
    sqlite3SchemaClear(db->aDb[1].pSchema);







<
<
|






>
>
>
>







1028
1029
1030
1031
1032
1033
1034


1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
  /* Free any outstanding Savepoint structures. */
  sqlite3CloseSavepoints(db);

  /* Close all database connections */
  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){


      if( pDb->pSchema ){
        /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */
        for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
          Index *pIdx = sqliteHashData(i);
          sqlite3KeyInfoUnref(pIdx->pKeyInfo);
          pIdx->pKeyInfo = 0;
        }
      }
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 ){
        pDb->pSchema = 0;
      }
    }
  }
  /* Clear the TEMP schema separately and last */
  if( db->aDb[1].pSchema ){
    sqlite3SchemaClear(db->aDb[1].pSchema);