1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

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
This commit is contained in:
dan
2018-07-05 17:16:55 +00:00
4 changed files with 15 additions and 10 deletions

View File

@@ -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 ){