1
0
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:
drh
2010-07-30 11:20:35 +00:00
parent 3843a4c19a
commit abfb62f9bd
6 changed files with 161 additions and 14 deletions

View File

@@ -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;