SQLite

Check-in [720a3ceafc]
Login

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

Overview
Comment:Fix a problem with the previous commit.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | incr-vacuum-opt
Files: files | file ages | folders
SHA1: 720a3ceafc35b81936ed2eb1f07a7187d104f0a0
User & Date: dan 2013-02-22 20:57:47.269
Context
2013-02-23
16:40
If a rollback mode transaction reduces the size of the database file, avoid actually truncating the file until after the transaction has been committed (but before the db has been unlocked). This means pages that are removed from the database by truncating the file need not be journalled. (check-in: b73847f17b user: dan tags: incr-vacuum-opt)
2013-02-22
20:57
Fix a problem with the previous commit. (check-in: 720a3ceafc user: dan tags: incr-vacuum-opt)
20:16
Avoid moving pages more than once in an incremental vacuum operation. (check-in: c3939d2491 user: dan tags: incr-vacuum-opt)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
5057
5058
5059
5060
5061
5062
5063
5064
5065










5066
5067
5068
5069
5070
5071

5072
5073
5074
5075
5076
5077
5078
      }else if( k>0 ){
        /* Extract a leaf from the trunk */
        u32 closest;
        Pgno iPage;
        unsigned char *aData = pTrunk->aData;
        if( nearby>0 ){
          u32 i;
          int dist;
          closest = 0;










          dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
          for(i=1; i<k; i++){
            int d2 = sqlite3AbsInt32(get4byte(&aData[8+i*4]) - nearby);
            if( d2<dist ){
              closest = i;
              dist = d2;

            }
          }
        }else{
          closest = 0;
        }

        iPage = get4byte(&aData[8+closest*4]);







<

>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
>







5057
5058
5059
5060
5061
5062
5063

5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
      }else if( k>0 ){
        /* Extract a leaf from the trunk */
        u32 closest;
        Pgno iPage;
        unsigned char *aData = pTrunk->aData;
        if( nearby>0 ){
          u32 i;

          closest = 0;
          if( eMode==BTALLOC_LE ){
            for(i=0; i<k; i++){
              iPage = get4byte(&aData[8+i*4]);
              if( iPage<nearby ){
                closest = i;
                break;
              }
            }
          }else{
            int dist;
            dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
            for(i=1; i<k; i++){
              int d2 = sqlite3AbsInt32(get4byte(&aData[8+i*4]) - nearby);
              if( d2<dist ){
                closest = i;
                dist = d2;
              }
            }
          }
        }else{
          closest = 0;
        }

        iPage = get4byte(&aData[8+closest*4]);