aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2018-07-05 17:16:55 +0000
committerdan <dan@noemail.net>2018-07-05 17:16:55 +0000
commit8bf6d705f3eaaa40b3739fdd0e38e0289da647f6 (patch)
tree55811018c87b73aeab097fff43cf29afedfecd36 /src
parent7fee0bfad2234d0cd3b32cae84ad60c8bbddeaf2 (diff)
parentb775104357ff834e2e1e726ff945e74dde4605bf (diff)
downloadsqlite-8bf6d705f3eaaa40b3739fdd0e38e0289da647f6.tar.gz
sqlite-8bf6d705f3eaaa40b3739fdd0e38e0289da647f6.zip
In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that
upgrades from no transaction directly to a write transaction) hits an SQLITE_BUSY_SNAPSHOT error, change the error code to SQLITE_BUSY to indicate to the caller that the condition may be transient. FossilOrigin-Name: e6108047cb136119d8ed19af010a669ed9750b4e7f991ccabc9e3d15774eda31
Diffstat (limited to 'src')
-rw-r--r--src/btree.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/btree.c b/src/btree.c
index d2c580d11..20cc3eb10 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -3375,6 +3375,11 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVersion){
rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db));
if( rc==SQLITE_OK ){
rc = newDatabase(pBt);
+ }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){
+ /* if there was no transaction opened when this function was
+ ** called and SQLITE_BUSY_SNAPSHOT is returned, change the error
+ ** code to SQLITE_BUSY. */
+ rc = SQLITE_BUSY;
}
}
}
@@ -3426,7 +3431,6 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVersion){
}
}
-
trans_begun:
if( rc==SQLITE_OK ){
if( pSchemaVersion ){