Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch exp-snapshot-open Excluding Merge-Ins
This is equivalent to a diff from 20c995d3 to 051ac015
2018-08-15
| ||
14:03 | Allow sqlite3_snapshot_open() to be called to change the snapshot after a read transaction is already open on database. (check-in: 41399169 user: dan tags: trunk) | |
2018-08-08
| ||
20:46 | Minor style improvements. (check-in: 60bbca2b user: mistachkin tags: trunk) | |
2018-08-06
| ||
17:12 | Allow sqlite3_snapshot_open() to be called to change the snapshot after a read transaction is already open on database. (Closed-Leaf check-in: 051ac015 user: dan tags: exp-snapshot-open) | |
02:08 | Enhance the edit() function so that it converts text from \r\n back into \n only if the original unedited copy contained no \r\n values. (check-in: 20c995d3 user: drh tags: trunk) | |
01:39 | Add the --info option to the fuzzcheck test utility. (check-in: 1caaaaa7 user: drh tags: trunk) | |
Changes to src/main.c.
︙ | |||
4205 4206 4207 4208 4209 4210 4211 | 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 | + + + - - + + + + + + + + + + + + + + - + + + + | #endif sqlite3_mutex_enter(db->mutex); if( db->autoCommit==0 ){ int iDb; iDb = sqlite3FindDbName(db, zDb); if( iDb==0 || iDb>1 ){ Btree *pBt = db->aDb[iDb].pBt; if( sqlite3BtreeIsInTrans(pBt)==0 ){ Pager *pPager = sqlite3BtreePager(pBt); int bUnlock = 0; |
︙ |
Changes to src/pager.c.
︙ | |||
7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 | 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | if( pPager->pWal ){ rc = sqlite3WalSnapshotRecover(pPager->pWal); }else{ rc = SQLITE_ERROR; } return rc; } /* ** The caller currently has a read transaction open on the database. ** If this is not a WAL database, SQLITE_ERROR is returned. Otherwise, ** this function takes a SHARED lock on the CHECKPOINTER slot and then ** checks if the snapshot passed as the second argument is still ** available. If so, SQLITE_OK is returned. ** ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER ** lock is released before returning. */ int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot){ int rc; if( pPager->pWal ){ rc = sqlite3WalSnapshotCheck(pPager->pWal, pSnapshot); }else{ rc = SQLITE_ERROR; } return rc; } /* ** Release a lock obtained by an earlier successful call to ** sqlite3PagerSnapshotCheck(). */ void sqlite3PagerSnapshotUnlock(Pager *pPager){ assert( pPager->pWal ); return sqlite3WalSnapshotUnlock(pPager->pWal); } #endif /* SQLITE_ENABLE_SNAPSHOT */ #endif /* !SQLITE_OMIT_WAL */ #ifdef SQLITE_ENABLE_ZIPVFS /* ** A read-lock must be held on the pager when this function is called. If ** the pager is in WAL mode and the WAL file currently contains one or more |
︙ |
Changes to src/pager.h.
︙ | |||
182 183 184 185 186 187 188 189 190 191 192 193 194 195 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | + + | # ifdef SQLITE_DIRECT_OVERFLOW_READ int sqlite3PagerUseWal(Pager *pPager, Pgno); # endif # ifdef SQLITE_ENABLE_SNAPSHOT int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot); int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot); int sqlite3PagerSnapshotRecover(Pager *pPager); int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot); void sqlite3PagerSnapshotUnlock(Pager *pPager); # endif #else # define sqlite3PagerUseWal(x,y) 0 #endif #ifdef SQLITE_ENABLE_ZIPVFS int sqlite3PagerWalFramesize(Pager *pPager); |
︙ |
Changes to src/sqlite.h.in.
︙ | |||
9031 9032 9033 9034 9035 9036 9037 | 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 | - - - - + + + + - - - + + - + - - - - + + + + + + + + - - - + + + + + + + + + + + | sqlite3_snapshot **ppSnapshot ); /* ** CAPI3REF: Start a read transaction on an historical snapshot ** METHOD: sqlite3_snapshot ** |
︙ |
Changes to src/test1.c.
︙ | |||
2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 | 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 | + + | zName = Tcl_GetString(objv[2]); pSnapshot = (sqlite3_snapshot*)sqlite3TestTextToPtr(Tcl_GetString(objv[3])); rc = sqlite3_snapshot_open(db, zName, pSnapshot); if( rc!=SQLITE_OK ){ Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1)); return TCL_ERROR; }else{ Tcl_ResetResult(interp); } return TCL_OK; } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_SNAPSHOT /* |
︙ |
Changes to src/wal.c.
︙ | |||
3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 | 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ** is incremented each time the wal file is restarted. */ if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1; if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1; if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1; if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1; return 0; } /* ** The caller currently has a read transaction open on the database. ** This function takes a SHARED lock on the CHECKPOINTER slot and then ** checks if the snapshot passed as the second argument is still ** available. If so, SQLITE_OK is returned. ** ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER ** lock is released before returning. */ int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){ int rc; rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot; if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted ){ rc = SQLITE_BUSY_SNAPSHOT; walUnlockShared(pWal, WAL_CKPT_LOCK); } } return rc; } /* ** Release a lock obtained by an earlier successful call to ** sqlite3WalSnapshotCheck(). */ void sqlite3WalSnapshotUnlock(Wal *pWal){ assert( pWal ); walUnlockShared(pWal, WAL_CKPT_LOCK); } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_ZIPVFS /* ** If the argument is not NULL, it points to a Wal object that holds a ** read-lock. This function returns the database page-size if it is known, ** or zero if it is not (or if pWal is NULL). |
︙ |
Changes to src/wal.h.
︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | + + | */ int sqlite3WalHeapMemory(Wal *pWal); #ifdef SQLITE_ENABLE_SNAPSHOT int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot); void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot); int sqlite3WalSnapshotRecover(Wal *pWal); int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot); void sqlite3WalSnapshotUnlock(Wal *pWal); #endif #ifdef SQLITE_ENABLE_ZIPVFS /* If the WAL file is not empty, return the number of bytes of content ** stored in each frame (i.e. the db page-size when the WAL was created). */ int sqlite3WalFramesize(Wal *pWal); |
︙ |
Changes to test/snapshot.test.
︙ | |||
213 214 215 216 217 218 219 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | + + + - - + + + + + + + + + - + + + + + + | do_test $tn.3.2.1 { execsql { BEGIN; SELECT * FROM t2; } } {a b c d e f} # Update - it is no longer an error to have a read-transaction open, # provided there are no active SELECT statements. |
︙ |
Added test/snapshot_up.test.