diff options
author | dan <dan@noemail.net> | 2018-07-05 17:16:55 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2018-07-05 17:16:55 +0000 |
commit | 8bf6d705f3eaaa40b3739fdd0e38e0289da647f6 (patch) | |
tree | 55811018c87b73aeab097fff43cf29afedfecd36 /src | |
parent | 7fee0bfad2234d0cd3b32cae84ad60c8bbddeaf2 (diff) | |
parent | b775104357ff834e2e1e726ff945e74dde4605bf (diff) | |
download | sqlite-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.c | 6 |
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 ){ |