From: dan Date: Thu, 4 Aug 2011 18:43:37 +0000 (+0000) Subject: Fix a comment in vdbesort.c. X-Git-Tag: version-3.7.8~76^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f25eef9882bdaa63a92c1222e3bf7cf08eb511b5;p=thirdparty%2Fsqlite.git Fix a comment in vdbesort.c. FossilOrigin-Name: db8518cab8e329b1dbe4cd6c81b21ef3ea69fcb1 --- diff --git a/manifest b/manifest index c2cb6abec3..0c6b6c3b08 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sto\susing\spacked-memory-arrays\sinstead\sof\sb-trees\swhen\sperforming\san\soffline\smerge-sort\sfor\sCREATE\sINDEX.\sThis\smakes\sit\seasier\sto\scontrol\sthe\snumber\sof\sdisc\sseeks\srequired\swhen\smerging. -D 2011-08-04T12:14:04.747 +C Fix\sa\scomment\sin\svdbesort.c. +D 2011-08-04T18:43:37.790 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -245,7 +245,7 @@ F src/vdbeapi.c 11dc47987abacb76ad016dcf5abc0dc422482a98 F src/vdbeaux.c 8fb978eb73a97b34d352dd3ef3bff35b1b3fa7e9 F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3 F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b -F src/vdbesort.c e7d1a86ebe0501161988001514c6ce0d0bb76a5a +F src/vdbesort.c 87c3b2921cbfd29a7fd0ef834f29b5a4fd8be56e F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114 F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 F src/wal.c 0c70ad7b1cac6005fa5e2cbefd23ee05e391c290 @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 7f339c0e2655310d7530041c379b082d49ce8c7f -R d1224a68c01eeac1a445468ca51c2250 +P a4770d079c1b236eb54751e75a44cccc997c6b93 +R ec95e9bd54ef30cddfc95ab39fec1eee U dan -Z 3f3c28dfd1bf55734d647cab0b6dad47 +Z 35780c1186756c8599cb8966b7d9180f diff --git a/manifest.uuid b/manifest.uuid index 5adf05ac71..c35a8ab1a4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a4770d079c1b236eb54751e75a44cccc997c6b93 \ No newline at end of file +db8518cab8e329b1dbe4cd6c81b21ef3ea69fcb1 \ No newline at end of file diff --git a/src/vdbesort.c b/src/vdbesort.c index a8abff9b23..6ee9a15dfa 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -21,24 +21,23 @@ typedef struct VdbeSorterIter VdbeSorterIter; /* -** The aIter[] and aTree[] arrays are used to iterate through the sorter -** contents after it has been populated. To iterate through the sorter -** contents, the contents of all packed-memory-arrays (PMAs) must be -** merged. This structure supports merging any number of arrays in a -** single pass with no redundant comparison operations. +** As keys are added to the sorter, they are written to disk in a series +** of sorted packed-memory-arrays (PMAs). The size of each PMA is roughly +** the same as the cache-size allowed for temporary databases. In order +** to allow the caller to extract keys from the sorter in sorted order, +** all PMAs currently stored on disk must be merged together. This comment +** describes the data structure used to do so. The structure supports +** merging any number of arrays in a single pass with no redundant comparison +** operations. ** -** TODO: It may turn out that the optimum number of PMAs to merge in a -** single pass is 2. If this is the case, this data structure could be -** simplified. +** The aIter[] array contains an iterator for each of the PMAs being merged. +** An aIter[] iterator either points to a valid key or else is at EOF. For +** the purposes of the paragraphs below, we assume that the array is actually +** N elements in size, where N is the smallest power of 2 greater to or equal +** to the number of iterators being merged. The extra aIter[] elements are +** treated as if they are empty (always at EOF). ** -** The first few elements of the aIter[] array contain pointers into -** each of the PMAs being merged. An aIter[] element either points to a -** valid key or else is at EOF. For the purposes of the paragraphs below, -** we assume that the array is actually N elements in size, where N is the -** smallest power of 2 greater to or equal to nRoot. The extra aIter[] -** elements are treated as if they are empty PMAs (always at EOF). -** -** The aTree[] array is N elements in size. The value of N is stored in +** The aTree[] array is also N elements in size. The value of N is stored in ** the VdbeSorter.nTree variable. ** ** The final (N/2) elements of aTree[] contain the results of comparing