/ Check-in [9d13acc4]
Login

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

Overview
Comment:Remove all cache pages from the LRU list prior to removing the pager from the pager list when closing a pager.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.5.9
Files: files | file ages | folders
SHA1: 9d13acc4493ee8be9e6cbf887cd7876d6239b952
User & Date: drh 2010-01-30 19:00:55
Context
2010-01-30
19:17
Avoid a race condition in the sqlite3_release_memory() logic within pager.c. check-in: a718e663 user: drh tags: branch-3.5.9
19:00
Remove all cache pages from the LRU list prior to removing the pager from the pager list when closing a pager. check-in: 9d13acc4 user: drh tags: branch-3.5.9
18:22
Add additional pagerMutexHeld() macros to better verify the correct operation of pager.c. check-in: c50e972f user: drh tags: branch-3.5.9
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  2752   2752   **
  2753   2753   ** This function always succeeds. If a transaction is active an attempt
  2754   2754   ** is made to roll it back. If an error occurs during the rollback 
  2755   2755   ** a hot journal may be left in the filesystem but no error is returned
  2756   2756   ** to the caller.
  2757   2757   */
  2758   2758   int sqlite3PagerClose(Pager *pPager){
         2759  +  pagerEnter(pPager);
         2760  +  pPager->errCode = 0;
         2761  +  pager_reset(pPager);
         2762  +  pagerLeave(pPager);
  2759   2763   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  2760   2764     if( !MEMDB ){
  2761   2765   #ifndef SQLITE_MUTEX_NOOP
  2762   2766       sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2);
  2763   2767   #endif
  2764   2768       sqlite3_mutex_enter(mutex);
  2765   2769       if( pPager->pPrev ){
................................................................................
  2770   2774       if( pPager->pNext ){
  2771   2775         pPager->pNext->pPrev = pPager->pPrev;
  2772   2776       }
  2773   2777       sqlite3_mutex_leave(mutex);
  2774   2778       pPager->onPagerList = 0;
  2775   2779     }
  2776   2780   #endif
  2777         -
  2778   2781     disable_simulated_io_errors();
  2779   2782     sqlite3FaultBeginBenign(-1);
  2780         -  pPager->errCode = 0;
  2781   2783     pPager->exclusiveMode = 0;
  2782         -  pager_reset(pPager);
  2783   2784     pagerUnlockAndRollback(pPager);
  2784   2785     enable_simulated_io_errors();
  2785   2786     sqlite3FaultEndBenign(-1);
  2786   2787     PAGERTRACE2("CLOSE %d\n", PAGERID(pPager));
  2787   2788     IOTRACE(("CLOSE %p\n", pPager))
  2788   2789     if( pPager->journalOpen ){
  2789   2790       sqlite3OsClose(pPager->jfd);