Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an LSM problem caused by using the same cursor for equality and range scans. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f05bead371d41ca5beef1f82e4c920c9 |
User & Date: | dan 2018-07-07 20:13:32.703 |
Context
2018-07-07
| ||
20:23 | Fix the JSON extension so that it can be compiled separately from the amalgamation. (check-in: 4b8cfe7bfe user: drh tags: trunk) | |
20:13 | Fix an LSM problem caused by using the same cursor for equality and range scans. (check-in: f05bead371 user: dan tags: trunk) | |
19:47 | Add ALWAYS() macros on results of sqlite3_aggregate_context() calls in xInverse() implements, since they can never fail. (check-in: fdef2a921d user: drh tags: trunk) | |
Changes
Changes to ext/lsm1/lsm-test/lsmtest1.c.
︙ | ︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | int *pRc /* OUT: Error code */ ){ int i; int iDot; int rc = LSM_OK; Datasource *pData; TestDb *pDb; /* Start the test case, open a database and allocate the datasource. */ pDb = testOpen(zSystem, 1, &rc); pData = testDatasourceNew(&p->defn); i = 0; iDot = 0; while( rc==LSM_OK && i<p->nRow ){ /* Insert some data */ testWriteDatasourceRange(pDb, pData, i, p->nVerify, &rc); i += p->nVerify; /* Check that the db content is correct. */ testDbContents(pDb, pData, p->nRow, 0, i-1, p->nTest, p->bTestScan, &rc); if( bRecover ){ testReopenRecover(&pDb, &rc); }else{ testReopen(&pDb, &rc); } | > > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | int *pRc /* OUT: Error code */ ){ int i; int iDot; int rc = LSM_OK; Datasource *pData; TestDb *pDb; int iToggle = 0; /* Start the test case, open a database and allocate the datasource. */ pDb = testOpen(zSystem, 1, &rc); pData = testDatasourceNew(&p->defn); i = 0; iDot = 0; while( rc==LSM_OK && i<p->nRow ){ /* Insert some data */ testWriteDatasourceRange(pDb, pData, i, p->nVerify, &rc); i += p->nVerify; if( iToggle ) testBegin(pDb, 1, &rc); /* Check that the db content is correct. */ testDbContents(pDb, pData, p->nRow, 0, i-1, p->nTest, p->bTestScan, &rc); if( iToggle ) testCommit(pDb, 0, &rc); iToggle = (iToggle+1)%2; if( bRecover ){ testReopenRecover(&pDb, &rc); }else{ testReopen(&pDb, &rc); } |
︙ | ︙ |
Changes to ext/lsm1/lsm-test/lsmtest_tdb3.c.
︙ | ︙ | |||
613 614 615 616 617 618 619 | ){ int rc; LsmDb *pDb = (LsmDb *)pTestDb; lsm_cursor *csr; if( pKey==0 ) return LSM_OK; | > | | > > > > | > > > | | > > > > | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | ){ int rc; LsmDb *pDb = (LsmDb *)pTestDb; lsm_cursor *csr; if( pKey==0 ) return LSM_OK; if( pDb->pCsr==0 ){ rc = lsm_csr_open(pDb->db, &csr); if( rc!=LSM_OK ) return rc; }else{ csr = pDb->pCsr; } rc = lsm_csr_seek(csr, pKey, nKey, LSM_SEEK_EQ); if( rc==LSM_OK ){ if( lsm_csr_valid(csr) ){ const void *pVal; int nVal; rc = lsm_csr_value(csr, &pVal, &nVal); if( nVal>pDb->nBuf ){ testFree(pDb->pBuf); pDb->pBuf = testMalloc(nVal*2); pDb->nBuf = nVal*2; } memcpy(pDb->pBuf, pVal, nVal); *ppVal = pDb->pBuf; *pnVal = nVal; }else{ *ppVal = 0; *pnVal = -1; } } if( pDb->pCsr==0 ){ lsm_csr_close(csr); } return rc; } static int test_lsm_scan( TestDb *pTestDb, void *pCtx, int bReverse, void *pFirst, int nFirst, void *pLast, int nLast, void (*xCallback)(void *, void *, int , void *, int) ){ LsmDb *pDb = (LsmDb *)pTestDb; lsm_cursor *csr; lsm_cursor *csr2 = 0; int rc; if( pDb->pCsr==0 ){ rc = lsm_csr_open(pDb->db, &csr); if( rc!=LSM_OK ) return rc; }else{ rc = LSM_OK; csr = pDb->pCsr; } if( bReverse ){ if( pLast ){ rc = lsm_csr_seek(csr, pLast, nLast, LSM_SEEK_LE); }else{ rc = lsm_csr_last(csr); } |
︙ | ︙ | |||
692 693 694 695 696 697 698 | if( bReverse ){ rc = lsm_csr_prev(csr); }else{ rc = lsm_csr_next(csr); } } | > | > | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 | if( bReverse ){ rc = lsm_csr_prev(csr); }else{ rc = lsm_csr_next(csr); } } if( pDb->pCsr==0 ){ lsm_csr_close(csr); } return rc; } static int test_lsm_begin(TestDb *pTestDb, int iLevel){ int rc = LSM_OK; LsmDb *pDb = (LsmDb *)pTestDb; |
︙ | ︙ | |||
757 758 759 760 761 762 763 764 765 766 767 768 769 770 | #define TEST_NO_RECOVERY -1 #define TEST_COMPRESSION -3 #define TEST_MT_MODE -2 #define TEST_MT_MIN_CKPT -4 #define TEST_MT_MAX_CKPT -5 int test_lsm_config_str( LsmDb *pLsm, lsm_db *db, int bWorker, const char *zStr, int *pnThread | > | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | #define TEST_NO_RECOVERY -1 #define TEST_COMPRESSION -3 #define TEST_MT_MODE -2 #define TEST_MT_MIN_CKPT -4 #define TEST_MT_MAX_CKPT -5 int test_lsm_config_str( LsmDb *pLsm, lsm_db *db, int bWorker, const char *zStr, int *pnThread |
︙ | ︙ |
Changes to ext/lsm1/lsm_sorted.c.
︙ | ︙ | |||
2864 2865 2866 2867 2868 2869 2870 | } static int multiCursorEnd(MultiCursor *pCsr, int bLast){ int rc = LSM_OK; int i; | | | 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 | } static int multiCursorEnd(MultiCursor *pCsr, int bLast){ int rc = LSM_OK; int i; pCsr->flags &= ~(CURSOR_NEXT_OK | CURSOR_PREV_OK | CURSOR_SEEK_EQ); pCsr->flags |= (bLast ? CURSOR_PREV_OK : CURSOR_NEXT_OK); pCsr->iFree = 0; /* Position the two in-memory tree cursors */ for(i=0; rc==LSM_OK && i<2; i++){ if( pCsr->apTreeCsr[i] ){ rc = lsmTreeCursorEnd(pCsr->apTreeCsr[i], bLast); |
︙ | ︙ |