/ Check-in [ae3fc765]
Login

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

Overview
Comment:Fix another problem with reusing LSM cursors for range scans.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:ae3fc7652f27ba0a86f4c26f64c2e148d9496a5edb7f54dc9980edd91c326e4f
User & Date: dan 2018-07-07 20:26:30
Context
2018-07-07
20:55
Simplifications to the implementation of the sum() SQL function. check-in: a8b13002 user: drh tags: trunk
20:26
Fix another problem with reusing LSM cursors for range scans. check-in: ae3fc765 user: dan tags: trunk
20:23
Fix the JSON extension so that it can be compiled separately from the amalgamation. check-in: 4b8cfe7b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/lsm1/lsm-test/lsmtest_tdb3.c.

   664    664     if( pDb->pCsr==0 ){
   665    665       rc = lsm_csr_open(pDb->db, &csr);
   666    666       if( rc!=LSM_OK ) return rc;
   667    667     }else{
   668    668       rc = LSM_OK;
   669    669       csr = pDb->pCsr;
   670    670     }
          671  +
          672  +  /* To enhance testing, if both pLast and pFirst are defined, seek the
          673  +  ** cursor to the "end" boundary here. Then the next block seeks it to
          674  +  ** the "start" ready for the scan. The point is to test that cursors
          675  +  ** can be reused.  */
          676  +  if( pLast && pFirst ){
          677  +    if( bReverse ){
          678  +      rc = lsm_csr_seek(csr, pFirst, nFirst, LSM_SEEK_LE);
          679  +    }else{
          680  +      rc = lsm_csr_seek(csr, pLast, nLast, LSM_SEEK_GE);
          681  +    }
          682  +  }
   671    683   
   672    684     if( bReverse ){
   673    685       if( pLast ){
   674    686         rc = lsm_csr_seek(csr, pLast, nLast, LSM_SEEK_LE);
   675    687       }else{
   676    688         rc = lsm_csr_last(csr);
   677    689       }

Changes to ext/lsm1/lsm_sorted.c.

  1918   1918       );
  1919   1919     }
  1920   1920   
  1921   1921     /* If (res<0), then key pKey/nKey is smaller than the split-key (or this
  1922   1922     ** is not a composite level and there is no split-key). Search the 
  1923   1923     ** left-hand-side of the level in this case.  */
  1924   1924     if( res<0 ){
         1925  +    int i;
  1925   1926       int iPtr = 0;
  1926   1927       if( nRhs==0 ) iPtr = (int)*piPgno;
  1927   1928   
  1928   1929       rc = seekInSegment(
  1929   1930           pCsr, &aPtr[0], iTopic, pKey, nKey, iPtr, eSeek, &iOut, &bStop
  1930   1931       );
  1931   1932       if( rc==LSM_OK && nRhs>0 && eSeek==LSM_SEEK_GE && aPtr[0].pPg==0 ){
  1932   1933         res = 0;
  1933   1934       }
         1935  +    for(i=1; i<=nRhs; i++){
         1936  +      segmentPtrReset(&aPtr[i], LSM_SEGMENTPTR_FREE_THRESHOLD);
         1937  +    }
  1934   1938     }
  1935   1939     
  1936   1940     if( res>=0 ){
  1937   1941       int bHit = 0;                 /* True if at least one rhs is not EOF */
  1938   1942       int iPtr = (int)*piPgno;
  1939   1943       int i;
         1944  +    segmentPtrReset(&aPtr[0], LSM_SEGMENTPTR_FREE_THRESHOLD);
  1940   1945       for(i=1; rc==LSM_OK && i<=nRhs && bStop==0; i++){
  1941   1946         SegmentPtr *pPtr = &aPtr[i];
  1942   1947         iOut = 0;
  1943   1948         rc = seekInSegment(
  1944   1949             pCsr, pPtr, iTopic, pKey, nKey, iPtr, eSeek, &iOut, &bStop
  1945   1950         );
  1946   1951         iPtr = iOut;