SQLite

Check-in [651ed97de1]
Login

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

Overview
Comment:When closing a (shared-cache) database connection, be sure to clear out all KeyInfo objects cached on Index objects. Proposed fix for ticket [e4a18565a36884b00edf].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fix-stale-keyinfo-cache
Files: files | file ages | folders
SHA1: 651ed97de13234be60a1138a98b06d308449a791
User & Date: drh 2014-12-05 05:38:02.138
Context
2014-12-05
14:07
Test case demonstrating the problem described by ticket [e4a18565a36884b00edf]. (check-in: ffea3e905a user: drh tags: fix-stale-keyinfo-cache)
05:38
When closing a (shared-cache) database connection, be sure to clear out all KeyInfo objects cached on Index objects. Proposed fix for ticket [e4a18565a36884b00edf]. (check-in: 651ed97de1 user: drh tags: fix-stale-keyinfo-cache)
00:32
Fix compiler warnings. (check-in: e9955c0e14 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
1030
1031
1032
1033
1034
1035
1036
1037






1038
1039
1040
1041
1042
1043
1044

  /* 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 = 0;
      }
    }
  }
  /* Clear the TEMP schema separately and last */
  if( db->aDb[1].pSchema ){
    sqlite3SchemaClear(db->aDb[1].pSchema);







|
>
>
>
>
>
>







1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050

  /* 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);