/ Check-in [c8eac290]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Avoid calling xRead() on a part of the database file that is memory mapped.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-mmap
Files: files | file ages | folders
SHA1: c8eac290a7240d69494bd0dad5ed1fdc2505f703
User & Date: dan 2013-03-21 20:00:07
Context
2013-03-21
20:39
Fix cases where xRead() was being used to read from a memory mapped part of the database file. check-in: 5c9e9df2 user: dan tags: experimental-mmap
20:00
Avoid calling xRead() on a part of the database file that is memory mapped. check-in: c8eac290 user: dan tags: experimental-mmap
15:57
Fix a problem when opening a write-transaction while there exist read-only b-tree cursors in mmap mode. check-in: 32e0bbb7 user: dan tags: experimental-mmap
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

5126
5127
5128
5129
5130
5131
5132
5133
5134



5135

5136
5137
5138
5139
5140
5141
5142
      */
      Pgno nPage = 0;
      char dbFileVers[sizeof(pPager->dbFileVers)];

      rc = pagerPagecount(pPager, &nPage);
      if( rc ) goto failed;

      if( nPage>0 ){
        IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));



        rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);

        if( rc!=SQLITE_OK ){
          goto failed;
        }
      }else{
        memset(dbFileVers, 0, sizeof(dbFileVers));
      }








|

>
>
>
|
>







5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
      */
      Pgno nPage = 0;
      char dbFileVers[sizeof(pPager->dbFileVers)];

      rc = pagerPagecount(pPager, &nPage);
      if( rc ) goto failed;

      if( nPage>0 || pPager->pMap ){
        IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));
        if( pPager->pMap ){
          memcpy(&dbFileVers, &((u8 *)(pPager->pMap))[24], sizeof(dbFileVers));
        }else{
          rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
        }
        if( rc!=SQLITE_OK ){
          goto failed;
        }
      }else{
        memset(dbFileVers, 0, sizeof(dbFileVers));
      }