/ Check-in [20e5ffb1]
Login

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

Overview
Comment:An unintentional fork was created due to a typo when creating branch-3.18. This check-in resolves the fork and is the 3.18.1 release candidate.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.18
Files: files | file ages | folders
SHA3-256: 20e5ffb1ceed514bf812ea5a2ce027b55203612bdbf8116a69f0cd52c67dbb84
User & Date: drh 2017-06-16 12:15:25
Context
2017-06-16
13:41
Version 3.18.1 check-in: 77bb4623 user: drh tags: release, branch-3.18, version-3.18.1
12:15
An unintentional fork was created due to a typo when creating branch-3.18. This check-in resolves the fork and is the 3.18.1 release candidate. check-in: 20e5ffb1 user: drh tags: branch-3.18
2017-06-15
07:47
Increase the version number to 3.18.1. check-in: 4be2eba8 user: drh tags: branch-3.18
2017-06-12
23:44
Ensure pointer map entries are always added when a row that does use overflow pages replaces one that does not in an auto-vacuum database. Fix for [fda22108]. check-in: 30c50f0e user: drh tags: branch-3.18
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/btree.c.

  8171   8171         goto end_insert;
  8172   8172       }
  8173   8173       oldCell = findCell(pPage, idx);
  8174   8174       if( !pPage->leaf ){
  8175   8175         memcpy(newCell, oldCell, 4);
  8176   8176       }
  8177   8177       rc = clearCell(pPage, oldCell, &info);
  8178         -    if( info.nSize==szNew && info.nLocal==info.nPayload ){
         8178  +    if( info.nSize==szNew && info.nLocal==info.nPayload 
         8179  +     && (!ISAUTOVACUUM || szNew<pPage->minLocal)
         8180  +    ){
  8179   8181         /* Overwrite the old cell with the new if they are the same size.
  8180   8182         ** We could also try to do this if the old cell is smaller, then add
  8181   8183         ** the leftover space to the free list.  But experiments show that
  8182   8184         ** doing that is no faster then skipping this optimization and just
  8183         -      ** calling dropCell() and insertCell(). */
         8185  +      ** calling dropCell() and insertCell(). 
         8186  +      **
         8187  +      ** This optimization cannot be used on an autovacuum database if the
         8188  +      ** new entry uses overflow pages, as the insertCell() call below is
         8189  +      ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry.  */
  8184   8190         assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */
  8185   8191         if( oldCell+szNew > pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;
  8186   8192         memcpy(oldCell, newCell, szNew);
  8187   8193         return SQLITE_OK;
  8188   8194       }
  8189   8195       dropCell(pPage, idx, info.nSize, &rc);
  8190   8196       if( rc ) goto end_insert;

Changes to test/autovacuum.test.

   701    701     execsql { INSERT INTO t1 SELECT NULL, randstr(50,50) FROM t1 }
   702    702   } {}
   703    703   do_test autovacuum-9.5 {
   704    704     execsql { DELETE FROM t1 WHERE rowid > (SELECT max(a)/2 FROM t1) }
   705    705     file size test.db
   706    706   } $::sqlite_pending_byte
   707    707    
          708  +do_execsql_test autovacuum-10.1 {
          709  +  DROP TABLE t1;
          710  +  CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
          711  +  INSERT INTO t1 VALUES(25, randomblob(104));
          712  +  REPLACE INTO t1 VALUES(25, randomblob(1117));
          713  +  PRAGMA integrity_check;
          714  +} {ok}
   708    715   
   709    716   finish_test