mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Cherry-pick the multi-file transaction fix for ticket [f3e5abed55] out of
the experimental branch. FossilOrigin-Name: 40f7f0a583e6bba66cd006253a0ef4623ea74f17
This commit is contained in:
@@ -1646,9 +1646,6 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
** to the transaction.
|
||||
*/
|
||||
rc = sqlite3VtabSync(db, &p->zErrMsg);
|
||||
if( rc!=SQLITE_OK ){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* This loop determines (a) if the commit hook should be invoked and
|
||||
** (b) how many database files have open write transactions, not
|
||||
@@ -1656,13 +1653,17 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
** one database file has an open write transaction, a master journal
|
||||
** file is required for an atomic commit.
|
||||
*/
|
||||
for(i=0; i<db->nDb; i++){
|
||||
for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
|
||||
Btree *pBt = db->aDb[i].pBt;
|
||||
if( sqlite3BtreeIsInTrans(pBt) ){
|
||||
needXcommit = 1;
|
||||
if( i!=1 ) nTrans++;
|
||||
rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt));
|
||||
}
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* If there are any write-transactions at all, invoke the commit hook */
|
||||
if( needXcommit && db->xCommitCallback ){
|
||||
@@ -1801,6 +1802,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
}
|
||||
}
|
||||
sqlite3OsCloseFree(pMaster);
|
||||
assert( rc!=SQLITE_BUSY );
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3DbFree(db, zMaster);
|
||||
return rc;
|
||||
|
||||
Reference in New Issue
Block a user