mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +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: 221ff63e7902226ebf728bb7442727420636831163708f360724506ce9487ab6
This commit is contained in:
@@ -3424,6 +3424,14 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag, int *pSchemaVersion){
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){
|
||||
/* Even if there was no transaction opened when this function was
|
||||
** called, a race condition may cause an SQLITE_BUSY_SNAPSHOT error
|
||||
** in wal mode (since the code above opens a read-transaction and then
|
||||
** upgrades it to a write-transaction - it does not take the write lock
|
||||
** atomically). In this case change the error code to SQLITE_BUSY. */
|
||||
assert( wrFlag );
|
||||
rc = SQLITE_BUSY;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user