-C Fix\san\sassert()\sin\sfts5\sthat\scould\sfail\sif\sthe\sdatabase\sis\scorrupt.
-D 2019-02-01T14:40:44.768
+C Improve\sthe\sstrict\senforcement\sof\scell\ssizes\sin\sbalancing\sfrom\ncheck-in\s[12713f320b2c1def]\sso\sthat\sit\salso\sworks\swith\stable-btrees\nin\saddition\sto\sindex-btrees.
+D 2019-02-01T14:50:43.745
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 178d8eb6840771149cee40b322d1b3be30d330198c522c903c1b66fb5a1bfca4
F src/backup.c 78d3cecfbe28230a3a9a1793e2ead609f469be43e8f486ca996006be551857ab
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
-F src/btree.c 79464668601b6d278954cf822ef484893e1434f85addda2bd9a323796b91b328
+F src/btree.c 9649c95a846deddf256525125ae257ef1ce0cf29409031df8378330a45d513a6
F src/btree.h febb2e817be499570b7a2e32a9bbb4b607a9234f6b84bb9ae84916d4806e96f2
F src/btreeInt.h cd82f0f08886078bf99b29e1a7045960b1ca5d9d5829c38607e1299c508eaf00
F src/build.c fe6e3753c4cfc76f9c621a24ef5f6fd62aac5aa6c843710b542509f493274eca
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9876ae1b802a449aacbbdd42778653edc19e29315dc627c23ab7493d6492c800
-R 37889ca5f23631d6a97887212bc95ece
-U dan
-Z f38e72163280904b28dc1d9373c8a5e6
+P 55f06aa3f890dc1dc5c2ed0e6777e46d609a6f9d223d1d4b5813097ce4f4e797
+R 20b34459b8ccf247d9f81319ceb019f1
+U drh
+Z b1e6b3262e06a43d75a1c54043cfe677
** |Child-1| |Child-2| |Child-3|
** --------- --------- ---------
**
-** The order of cells is in the array is:
+** The order of cells is in the array is for an index btree is:
**
** 1. All cells from Child-1 in order
** 2. The first divider cell from Parent
** 4. The second divider cell from Parent
** 5. All cells from Child-3 in order
**
-** The apEnd[] array holds pointer to the end of page for Child-1, the
-** Parent, Child-2, the Parent (again), and Child-3. The ixNx[] array
-** holds the number of cells contained in each of these 5 stages, and
-** all stages to the left. Hence:
+** For a table-btree (with rowids) the items 2 and 4 are empty because
+** content exists only in leaves and there are no divider cells.
+**
+** For an index btree, the apEnd[] array holds pointer to the end of page
+** for Child-1, the Parent, Child-2, the Parent (again), and Child-3,
+** respectively. The ixNx[] array holds the number of cells contained in
+** each of these 5 stages, and all stages to the left. Hence:
+**
** ixNx[0] = Number of cells in Child-1.
** ixNx[1] = Number of cells in Child-1 plus 1 for first divider.
** ixNx[2] = Number of cells in Child-1 and Child-2 + 1 for 1st divider.
** ixNx[3] = Number of cells in Child-1 and Child-2 + both divider cells
** ixNx[4] = Total number of cells.
+**
+** For a table-btree, the concept is similar, except only apEnd[0]..apEnd[2]
+** are used and they point to the leaf pages only, and the ixNx value are:
+**
+** ixNx[0] = Number of cells in Child-1.
+** ixNx[1] = Number of cells in Child-1 and Child-2 + 1 for 1st divider.
+** ixNx[2] = Number of cells in Child-1 and Child-2 + both divider cells
*/
typedef struct CellArray CellArray;
struct CellArray {
**
*/
usableSpace = pBt->usableSize - 12 + leafCorrection;
- for(i=0; i<nOld; i++){
+ for(i=k=0; i<nOld; i++, k++){
MemPage *p = apOld[i];
- b.apEnd[i*2] = p->aDataEnd;
- b.apEnd[i*2+1] = pParent->aDataEnd;
- b.ixNx[i*2] = cntOld[i];
- b.ixNx[i*2+1] = cntOld[i]+1;
+ b.apEnd[k] = p->aDataEnd;
+ b.ixNx[k] = cntOld[i];
+ if( !leafData ){
+ k++;
+ b.apEnd[k] = pParent->aDataEnd;
+ b.ixNx[k] = cntOld[i]+1;
+ }
szNew[i] = usableSpace - p->nFree;
for(j=0; j<p->nOverflow; j++){
szNew[i] += 2 + p->xCellSize(p, p->apOvfl[j]);