/ Check-in [038ec9ea]
Login

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

Overview
Comment:Fix a problem with building large indexes introduced by the previous commit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1:038ec9ea92f7661358580d999adc400da14d47f0
User & Date: dan 2011-08-06 15:09:33
Context
2011-08-08
16:44
Add fault-injection and other tests (and fixes) to improve coverage of vdbesort.c. check-in: 0e6defa6 user: dan tags: experimental
2011-08-06
15:09
Fix a problem with building large indexes introduced by the previous commit. check-in: 038ec9ea user: dan tags: experimental
12:01
In temp files used for merge sorting, store the size of each packed-memory-array at the start of the array itself. This is to avoid having to store the offsets of all arrays in the (potentially very large) file in main-memory. check-in: 8051c176 user: dan tags: experimental
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbesort.c.

   549    549     nByte = N * (sizeof(int) + sizeof(VdbeSorterIter));
   550    550     pSorter->aIter = (VdbeSorterIter *)sqlite3DbMallocZero(db, nByte);
   551    551     if( !pSorter->aIter ) return SQLITE_NOMEM;
   552    552     pSorter->aTree = (int *)&pSorter->aIter[N];
   553    553     pSorter->nTree = N;
   554    554   
   555    555     do {
   556         -    int iNew = 0;                 /* Index of new, merged, PMA */
          556  +    int iNew;                     /* Index of new, merged, PMA */
   557    557   
   558         -    for(iNew=0; rc==SQLITE_OK; iNew++){
          558  +    for(iNew=0; 
          559  +        rc==SQLITE_OK && iNew*SORTER_MAX_MERGE_COUNT<pSorter->nPMA; 
          560  +        iNew++
          561  +    ){
   559    562         i64 nWrite;                 /* Number of bytes in new PMA */
   560    563   
   561    564         /* If there are SORTER_MAX_MERGE_COUNT or less PMAs in file pTemp1,
   562    565         ** initialize an iterator for each of them and break out of the loop.
   563    566         ** These iterators will be incrementally merged as the VDBE layer calls
   564    567         ** sqlite3VdbeSorterNext().
   565    568         **