SQLite

Check-in [038ec9ea92]
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
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: 038ec9ea92f7661358580d999adc400da14d47f0
User & Date: dan 2011-08-06 15:09:33.468
Context
2011-08-08
16:44
Add fault-injection and other tests (and fixes) to improve coverage of vdbesort.c. (check-in: 0e6defa6aa user: dan tags: experimental)
2011-08-06
15:09
Fix a problem with building large indexes introduced by the previous commit. (check-in: 038ec9ea92 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: 8051c1767c user: dan tags: experimental)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/vdbesort.c.
549
550
551
552
553
554
555
556

557
558




559
560
561
562
563
564
565
549
550
551
552
553
554
555

556
557

558
559
560
561
562
563
564
565
566
567
568







-
+

-
+
+
+
+







  nByte = N * (sizeof(int) + sizeof(VdbeSorterIter));
  pSorter->aIter = (VdbeSorterIter *)sqlite3DbMallocZero(db, nByte);
  if( !pSorter->aIter ) return SQLITE_NOMEM;
  pSorter->aTree = (int *)&pSorter->aIter[N];
  pSorter->nTree = N;

  do {
    int iNew = 0;                 /* Index of new, merged, PMA */
    int iNew;                     /* Index of new, merged, PMA */

    for(iNew=0; rc==SQLITE_OK; iNew++){
    for(iNew=0; 
        rc==SQLITE_OK && iNew*SORTER_MAX_MERGE_COUNT<pSorter->nPMA; 
        iNew++
    ){
      i64 nWrite;                 /* Number of bytes in new PMA */

      /* If there are SORTER_MAX_MERGE_COUNT or less PMAs in file pTemp1,
      ** initialize an iterator for each of them and break out of the loop.
      ** These iterators will be incrementally merged as the VDBE layer calls
      ** sqlite3VdbeSorterNext().
      **