SQLite4
Check-in [b3b4c58d9a]
Not logged in

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

Overview
Comment:Fix a problem in writing free-list entries to the LSM.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | range-delete-fixes
Files: files | file ages | folders
SHA1: b3b4c58d9a2932182b8e203a9419fd366d04a473
User & Date: dan 2012-11-03 19:51:36
Context
2012-11-05
10:23
Fix a bug in compressed database mode causing an incorrect page number to be assigned to a page record when the end of the previous record is aligned with the end of a database block. check-in: e6a71a8583 user: dan tags: range-delete-fixes
2012-11-03
19:51
Fix a problem in writing free-list entries to the LSM. check-in: b3b4c58d9a user: dan tags: range-delete-fixes
19:06
Various fixes and tests for range-deletes. check-in: 752517c1cf user: dan tags: range-delete-fixes
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/lsm_sorted.c.

1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954







1955
1956
1957
1958
1959
1960
1961
          }else if( aEntry[i].iId>=0 ){
            eType = LSM_INSERT|LSM_SYSTEMKEY;
            iKey = aEntry[i].iBlk;

            /* If the in-memory entry immediately before this one was a
             ** DELETE, and the block number is one greater than the current
             ** block number, mark this entry as an "end-delete-range". */
            if( i<(nEntry-1) 
                && aEntry[i+1].iBlk==aEntry[i].iBlk+1 && aEntry[i+1].iId<0
              ){
              eType |= LSM_END_DELETE;
            }

            /* If the in-memory entry immediately after this one is a
            ** DELETE, and the block number is one less than the current
            ** block number, mark this entry as an "start-delete-range". 
            ** Also increase iFree so that the next entry is not visited
            ** (since it has already been accounted for by setting this
            ** flag).  */
            if( i>0 
                && aEntry[i-1].iBlk==aEntry[i].iBlk-1 && aEntry[i-1].iId<0
              ){
              eType |= LSM_START_DELETE;
            }
          }else{
            eType = LSM_START_DELETE|LSM_SYSTEMKEY;
            iKey = aEntry[i].iBlk + 1;
          }








          pKey = pCsr->pSystemVal;
          nKey = 4;
          lsmPutU32(pKey, ~iKey);
        }
      }
      break;







|
<
<



<
<
<
<
<
<
<
<
<
<
<




>
>
>
>
>
>
>







1927
1928
1929
1930
1931
1932
1933
1934


1935
1936
1937











1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
          }else if( aEntry[i].iId>=0 ){
            eType = LSM_INSERT|LSM_SYSTEMKEY;
            iKey = aEntry[i].iBlk;

            /* If the in-memory entry immediately before this one was a
             ** DELETE, and the block number is one greater than the current
             ** block number, mark this entry as an "end-delete-range". */
            if( i<(nEntry-1) && aEntry[i+1].iBlk==iKey+1 && aEntry[i+1].iId<0 ){


              eType |= LSM_END_DELETE;
            }












          }else{
            eType = LSM_START_DELETE|LSM_SYSTEMKEY;
            iKey = aEntry[i].iBlk + 1;
          }

          /* If the in-memory entry immediately after this one is a
          ** DELETE, and the block number is one less than the current
          ** key, mark this entry as an "start-delete-range".  */
          if( i>0 && aEntry[i-1].iBlk==iKey-1 && aEntry[i-1].iId<0 ){
            eType |= LSM_START_DELETE;
          }

          pKey = pCsr->pSystemVal;
          nKey = 4;
          lsmPutU32(pKey, ~iKey);
        }
      }
      break;