If SQLITE_ENABLE_ZIPVFS is defined, journal_mode=off is configured and a savepoint or statement rollback is attempted, move the pager into the error state to prevent the transaction from being committed. This makes it safe to use journal_mode=off with zipvfs under some conditions.
FossilOrigin-Name: 38d31e189e7c7899e14455f2c083aa676ce4d4c0
This commit is contained in:
parent
a87070a271
commit
d0d49b9ca3
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Use\ssome\sof\sthe\sexample\scode\sfrom\sthe\ssessions\sdocumenatation\sin\sthe\ssessions\stest\scases.
|
||||
D 2016-08-29T14:18:18.207
|
||||
C If\sSQLITE_ENABLE_ZIPVFS\sis\sdefined,\sjournal_mode=off\sis\sconfigured\sand\sa\ssavepoint\sor\sstatement\srollback\sis\sattempted,\smove\sthe\spager\sinto\sthe\serror\sstate\sto\sprevent\sthe\stransaction\sfrom\sbeing\scommitted.\sThis\smakes\sit\ssafe\sto\suse\sjournal_mode=off\swith\szipvfs\sunder\ssome\sconditions.
|
||||
D 2016-09-01T09:35:20.703
|
||||
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5017381e4853b1472e01d5bb926be1268eba429c
|
||||
@ -371,7 +371,7 @@ F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c be9ca0f901a2b6c1bc93dc338f4863675180c189
|
||||
F src/os_win.c 520f23475f1de530c435d30b67b7b15fe90874b0
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 40928c450320da78bb4bd3ae82818f4239e19b7e
|
||||
F src/pager.c bf5b71bde3e9b6110e7d6990607db881f6a471a2
|
||||
F src/pager.h 966d2769e76ae347c8a32c4165faf6e6cb64546d
|
||||
F src/parse.y ed6990c2d41eb0302eda90d5009c51fec792c850
|
||||
F src/pcache.c 5583c8ade4b05075a60ba953ef471d1c1a9c05df
|
||||
@ -1511,7 +1511,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P a07269f2a0f87e0b736127f528f6caf3b63f9052
|
||||
R e338ebda27cef4eaa61a39e0a172ba0c
|
||||
P 6602974d17536bcb904a794bddedffd58926794b
|
||||
R 78dc0041209a92fe8b940a2665fbfc99
|
||||
U dan
|
||||
Z 11041cb022515aa05751c4e3c90843c8
|
||||
Z f1c8273131a5d41903cfd86ae1fce8b9
|
||||
|
@ -1 +1 @@
|
||||
6602974d17536bcb904a794bddedffd58926794b
|
||||
38d31e189e7c7899e14455f2c083aa676ce4d4c0
|
20
src/pager.c
20
src/pager.c
@ -6656,7 +6656,11 @@ int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){
|
||||
** savepoint. If no errors occur, SQLITE_OK is returned.
|
||||
*/
|
||||
int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
|
||||
int rc = pPager->errCode; /* Return code */
|
||||
int rc = pPager->errCode;
|
||||
|
||||
#ifdef SQLITE_ENABLE_ZIPVFS
|
||||
if( op==SAVEPOINT_RELEASE ) rc = SQLITE_OK;
|
||||
#endif
|
||||
|
||||
assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );
|
||||
assert( iSavepoint>=0 || op==SAVEPOINT_ROLLBACK );
|
||||
@ -6697,6 +6701,20 @@ int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
|
||||
rc = pagerPlaybackSavepoint(pPager, pSavepoint);
|
||||
assert(rc!=SQLITE_DONE);
|
||||
}
|
||||
|
||||
#ifdef SQLITE_ENABLE_ZIPVFS
|
||||
/* If the cache has been modified but the savepoint cannot be rolled
|
||||
** back journal_mode=off, put the pager in the error state. This way,
|
||||
** if the VFS used by this pager includes ZipVFS, the entire transaction
|
||||
** can be rolled back at the ZipVFS level. */
|
||||
else if(
|
||||
pPager->journalMode==PAGER_JOURNALMODE_OFF
|
||||
&& pPager->eState>=PAGER_WRITER_CACHEMOD
|
||||
){
|
||||
pPager->errCode = SQLITE_ABORT;
|
||||
pPager->eState = PAGER_ERROR;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
Loading…
Reference in New Issue
Block a user