Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge latest changes from trunk, including the temporary db/ATTACH/master-journal fix. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | apple-osx |
Files: | files | file ages | folders |
SHA3-256: |
162c7543654c79138b94c3f631d0e4fa |
User & Date: | dan 2017-11-17 13:23:44.351 |
Context
2017-11-17
| ||
20:10 | Merge test script fixes from trunk into this branch. (check-in: 32f5f46139 user: dan tags: apple-osx) | |
13:23 | Merge latest changes from trunk, including the temporary db/ATTACH/master-journal fix. (check-in: 162c754365 user: dan tags: apple-osx) | |
13:21 | Do not count temporary databases that have been attached using ATTACH when figuring out if a master-journal file is required by a transaction. (check-in: 93e012a317 user: dan tags: trunk) | |
2017-11-16
| ||
19:17 | Merge the latest changes, and the stmtvtab1.test fix, from trunk. (check-in: 85247880a6 user: drh tags: apple-osx) | |
Changes
Changes to ext/lsm1/lsm_sorted.c.
︙ | ︙ | |||
88 89 90 91 92 93 94 | ** The following macros are used to access a page footer. */ #define SEGMENT_NRECORD_OFFSET(pgsz) ((pgsz) - 2) #define SEGMENT_FLAGS_OFFSET(pgsz) ((pgsz) - 2 - 2) #define SEGMENT_POINTER_OFFSET(pgsz) ((pgsz) - 2 - 2 - 8) #define SEGMENT_CELLPTR_OFFSET(pgsz, iCell) ((pgsz) - 2 - 2 - 8 - 2 - (iCell)*2) | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | ** The following macros are used to access a page footer. */ #define SEGMENT_NRECORD_OFFSET(pgsz) ((pgsz) - 2) #define SEGMENT_FLAGS_OFFSET(pgsz) ((pgsz) - 2 - 2) #define SEGMENT_POINTER_OFFSET(pgsz) ((pgsz) - 2 - 2 - 8) #define SEGMENT_CELLPTR_OFFSET(pgsz, iCell) ((pgsz) - 2 - 2 - 8 - 2 - (iCell)*2) #define SEGMENT_EOF(pgsz, nEntry) SEGMENT_CELLPTR_OFFSET(pgsz, nEntry-1) #define SEGMENT_BTREE_FLAG 0x0001 #define PGFTR_SKIP_NEXT_FLAG 0x0002 #define PGFTR_SKIP_THIS_FLAG 0x0004 #ifndef LSM_SEGMENTPTR_FREE_THRESHOLD |
︙ | ︙ | |||
3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 | nHdr = 1 + lsmVarintLen32(iRPtr) + lsmVarintLen32(nKey); if( rtIsWrite(eType) ) nHdr += lsmVarintLen32(nVal); /* If the entire header will not fit on page pPg, or if page pPg is ** marked read-only, advance to the next page of the output run. */ iOff = pMerge->iOutputOff; if( iOff<0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){ iFPtr = (int)*pMW->pCsr->pPrevMergePtr; iRPtr = iPtr - iFPtr; iOff = 0; nRec = 0; rc = mergeWorkerNextPage(pMW, iFPtr); pPg = pMW->pPage; } | > > > > > | 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 | nHdr = 1 + lsmVarintLen32(iRPtr) + lsmVarintLen32(nKey); if( rtIsWrite(eType) ) nHdr += lsmVarintLen32(nVal); /* If the entire header will not fit on page pPg, or if page pPg is ** marked read-only, advance to the next page of the output run. */ iOff = pMerge->iOutputOff; if( iOff<0 || pPg==0 || iOff+nHdr > SEGMENT_EOF(nData, nRec+1) ){ if( iOff>=0 && pPg ){ /* Zero any free space on the page */ assert( aData ); memset(&aData[iOff], 0, SEGMENT_EOF(nData, nRec)-iOff); } iFPtr = (int)*pMW->pCsr->pPrevMergePtr; iRPtr = iPtr - iFPtr; iOff = 0; nRec = 0; rc = mergeWorkerNextPage(pMW, iFPtr); pPg = pMW->pPage; } |
︙ | ︙ | |||
4065 4066 4067 4068 4069 4070 4071 | int i; /* Iterator variable */ int rc = *pRc; MultiCursor *pCsr = pMW->pCsr; /* Unless the merge has finished, save the cursor position in the ** Merge.aInput[] array. See function mergeWorkerInit() for the ** code to restore a cursor position based on aInput[]. */ | | > | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > | 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 | int i; /* Iterator variable */ int rc = *pRc; MultiCursor *pCsr = pMW->pCsr; /* Unless the merge has finished, save the cursor position in the ** Merge.aInput[] array. See function mergeWorkerInit() for the ** code to restore a cursor position based on aInput[]. */ if( rc==LSM_OK && pCsr ){ Merge *pMerge = pMW->pLevel->pMerge; if( lsmMCursorValid(pCsr) ){ int bBtree = (pCsr->pBtCsr!=0); int iPtr; /* pMerge->nInput==0 indicates that this is a FlushTree() operation. */ assert( pMerge->nInput==0 || pMW->pLevel->nRight>0 ); assert( pMerge->nInput==0 || pMerge->nInput==(pCsr->nPtr+bBtree) ); for(i=0; i<(pMerge->nInput-bBtree); i++){ SegmentPtr *pPtr = &pCsr->aPtr[i]; if( pPtr->pPg ){ pMerge->aInput[i].iPg = lsmFsPageNumber(pPtr->pPg); pMerge->aInput[i].iCell = pPtr->iCell; }else{ pMerge->aInput[i].iPg = 0; pMerge->aInput[i].iCell = 0; } } if( bBtree && pMerge->nInput ){ assert( i==pCsr->nPtr ); btreeCursorPosition(pCsr->pBtCsr, &pMerge->aInput[i]); } /* Store the location of the split-key */ iPtr = pCsr->aTree[1] - CURSOR_DATA_SEGMENT; if( iPtr<pCsr->nPtr ){ pMerge->splitkey = pMerge->aInput[iPtr]; }else{ btreeCursorSplitkey(pCsr->pBtCsr, &pMerge->splitkey); } } /* Zero any free space left on the final page. This helps with ** compression if using a compression hook. And prevents valgrind ** from complaining about uninitialized byte passed to write(). */ if( pMW->pPage ){ int nData; u8 *aData = fsPageData(pMW->pPage, &nData); int iOff = pMerge->iOutputOff; int iEof = SEGMENT_EOF(nData, pageGetNRec(aData, nData)); memset(&aData[iOff], 0, iEof - iOff); } pMerge->iOutputOff = -1; } lsmMCursorClose(pCsr, 0); |
︙ | ︙ |
Changes to src/vdbeaux.c.
︙ | ︙ | |||
2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 | }; Pager *pPager; /* Pager associated with pBt */ needXcommit = 1; sqlite3BtreeEnter(pBt); pPager = sqlite3BtreePager(pBt); if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF && aMJNeeded[sqlite3PagerGetJournalMode(pPager)] ){ assert( i!=1 ); nTrans++; } rc = sqlite3PagerExclusiveLock(pPager); sqlite3BtreeLeave(pBt); } | > | 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 | }; Pager *pPager; /* Pager associated with pBt */ needXcommit = 1; sqlite3BtreeEnter(pBt); pPager = sqlite3BtreePager(pBt); if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF && aMJNeeded[sqlite3PagerGetJournalMode(pPager)] && sqlite3PagerIsMemdb(pPager)==0 ){ assert( i!=1 ); nTrans++; } rc = sqlite3PagerExclusiveLock(pPager); sqlite3BtreeLeave(pBt); } |
︙ | ︙ |
Changes to test/mjournal.test.
︙ | ︙ | |||
75 76 77 78 79 80 81 | hexio_write test1 0 abcd } {2} do_execsql_test 1.6 { SELECT * FROM t1; } | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | hexio_write test1 0 abcd } {2} do_execsql_test 1.6 { SELECT * FROM t1; } #------------------------------------------------------------------------- # Check that master journals are not created if the transaction involves # multiple temp files. # db close testvfs tvfs tvfs filter xOpen tvfs script open_cb set ::open "" proc open_cb {method file arglist} { lappend ::open $file } proc contains_mj {} { foreach f $::open { set t [file tail $f] if {[string match *mj* $t]} { return 1 } } return 0 } # Like [do_execsql_test], except that a boolean indicating whether or # not a master journal file was opened ([file tail] contains "mj") or # not. Example: # # do_hasmj_test 1.0 { SELECT 'a', 'b' } {0 a b} # proc do_hasmj_test {tn sql expected} { set ::open [list] uplevel [list do_test $tn [subst -nocommands { set res [execsql "$sql"] concat [contains_mj] [set res] }] [list {*}$expected]] } forcedelete test.db forcedelete test.db2 forcedelete test.db3 sqlite3 db test.db -vfs tvfs do_execsql_test 2.0 { ATTACH 'test.db2' AS dbfile; ATTACH '' AS dbtemp; ATTACH ':memory:' AS dbmem; CREATE TABLE t1(x); CREATE TABLE dbfile.t2(x); CREATE TABLE dbtemp.t3(x); CREATE TABLE dbmem.t4(x); } # Two real files. do_hasmj_test 2.1 { BEGIN; INSERT INTO t1 VALUES(1); INSERT INTO t2 VALUES(1); COMMIT; } {1} # One real, one temp file. do_hasmj_test 2.2 { BEGIN; INSERT INTO t1 VALUES(1); INSERT INTO t3 VALUES(1); COMMIT; } {0} # One file, one :memory: db. do_hasmj_test 2.3 { BEGIN; INSERT INTO t1 VALUES(1); INSERT INTO t4 VALUES(1); COMMIT; } {0} finish_test |