1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Do not automatically rollback at the btree or pager level if a commit fails. (CVS 2999)

FossilOrigin-Name: 0f6329ef1fe0d5b225b6381fda1e8d800f65ea0f
This commit is contained in:
danielk1977
2006-01-23 13:47:47 +00:00
parent c93cc42df8
commit 7f7bc66ef2
4 changed files with 21 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sto\ssqlite3AllocMalloc()\swhen\sit\sis\sa\sno-op\smacro.\s(CVS\s2998) C Do\snot\sautomatically\srollback\sat\sthe\sbtree\sor\spager\slevel\sif\sa\scommit\sfails.\s(CVS\s2999)
D 2006-01-23T13:28:54 D 2006-01-23T13:47:47
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -34,7 +34,7 @@ F src/alter.c 90b779cf00489535cab6490df6dc050f40e4e874
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
F src/attach.c 0081040e9a5d13669b6712e947688c10f030bfc1 F src/attach.c 0081040e9a5d13669b6712e947688c10f030bfc1
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2 F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c ab0f6813b32e0db14883a71bd228470989dea609 F src/btree.c e3cb390f7da8ebe9d81ffb59df2a9f9b65f9d344
F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184 F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184
F src/build.c 15224e2fd348ad32b9044aaa5bdc912e4067da15 F src/build.c 15224e2fd348ad32b9044aaa5bdc912e4067da15
F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2 F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2
@@ -59,7 +59,7 @@ F src/os_unix.c 38a55e51fb2c6f32c0ce86d274f5787f6c3668ed
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 98e4e38db7d4a00647b2bb1c60d28b7ca5034c03 F src/os_win.c 98e4e38db7d4a00647b2bb1c60d28b7ca5034c03
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 184a3045ff5243458f2fff41f0b8d2524da39660 F src/pager.c 9c0ac7536168f92eef1c4033ef97414d838cd504
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029 F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3 F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
@@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 1f42a338e2ee90f4c24a9eb19054c4b831dd661f P 8caa9f95b8a36e34510cf46d518bd63bd8fa0a32
R db1024d73945d88640ca69945bf51c00 R ee42ba01834fee9f6799c64d4ff28b9b
U drh U danielk1977
Z 098c9854808402d15135d501adfed3ef Z ad5bd029c9c2de6cb67cc213e02c05d2

View File

@@ -1 +1 @@
8caa9f95b8a36e34510cf46d518bd63bd8fa0a32 0f6329ef1fe0d5b225b6381fda1e8d800f65ea0f

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** May you share freely, never taking more than you give.
** **
************************************************************************* *************************************************************************
** $Id: btree.c,v 1.308 2006/01/23 13:00:36 drh Exp $ ** $Id: btree.c,v 1.309 2006/01/23 13:47:47 danielk1977 Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to ** For a detailed discussion of BTrees, refer to
@@ -2450,22 +2450,25 @@ autovacuum_out:
** are no active cursors, it also releases the read lock. ** are no active cursors, it also releases the read lock.
*/ */
int sqlite3BtreeCommit(Btree *p){ int sqlite3BtreeCommit(Btree *p){
int rc = SQLITE_OK;
BtShared *pBt = p->pBt; BtShared *pBt = p->pBt;
btreeIntegrity(p); btreeIntegrity(p);
unlockAllTables(p);
/* If the handle has a write-transaction open, commit the shared-btrees /* If the handle has a write-transaction open, commit the shared-btrees
** transaction and set the shared state to TRANS_READ. ** transaction and set the shared state to TRANS_READ.
*/ */
if( p->inTrans==TRANS_WRITE ){ if( p->inTrans==TRANS_WRITE ){
int rc;
assert( pBt->inTransaction==TRANS_WRITE ); assert( pBt->inTransaction==TRANS_WRITE );
assert( pBt->nTransaction>0 ); assert( pBt->nTransaction>0 );
rc = sqlite3pager_commit(pBt->pPager); rc = sqlite3pager_commit(pBt->pPager);
if( rc!=SQLITE_OK ){
return rc;
}
pBt->inTransaction = TRANS_READ; pBt->inTransaction = TRANS_READ;
pBt->inStmt = 0; pBt->inStmt = 0;
} }
unlockAllTables(p);
/* If the handle has any kind of transaction open, decrement the transaction /* If the handle has any kind of transaction open, decrement the transaction
** count of the shared btree. If the transaction count reaches 0, set ** count of the shared btree. If the transaction count reaches 0, set
@@ -2486,7 +2489,7 @@ int sqlite3BtreeCommit(Btree *p){
unlockBtreeIfUnused(pBt); unlockBtreeIfUnused(pBt);
btreeIntegrity(p); btreeIntegrity(p);
return rc; return SQLITE_OK;
} }
#ifndef NDEBUG #ifndef NDEBUG

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** another is writing.
** **
** @(#) $Id: pager.c,v 1.250 2006/01/23 13:09:46 danielk1977 Exp $ ** @(#) $Id: pager.c,v 1.251 2006/01/23 13:47:47 danielk1977 Exp $
*/ */
#ifndef SQLITE_OMIT_DISKIO #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -3249,16 +3249,8 @@ int sqlite3pager_commit(Pager *pPager){
int rc; int rc;
PgHdr *pPg; PgHdr *pPg;
if( pPager->errCode==SQLITE_FULL ){
rc = sqlite3pager_rollback(pPager);
if( rc==SQLITE_OK ){
rc = SQLITE_FULL;
}
return rc;
}
if( pPager->errCode ){ if( pPager->errCode ){
rc = pPager->errCode; return pPager->errCode;
return rc;
} }
if( pPager->state<PAGER_RESERVED ){ if( pPager->state<PAGER_RESERVED ){
return SQLITE_ERROR; return SQLITE_ERROR;
@@ -3296,17 +3288,10 @@ int sqlite3pager_commit(Pager *pPager){
} }
assert( pPager->journalOpen ); assert( pPager->journalOpen );
rc = sqlite3pager_sync(pPager, 0, 0); rc = sqlite3pager_sync(pPager, 0, 0);
if( rc!=SQLITE_OK ){ if( rc==SQLITE_OK ){
goto commit_abort;
}
rc = pager_unwritelock(pPager); rc = pager_unwritelock(pPager);
pPager->dbSize = -1; pPager->dbSize = -1;
return rc; }
/* Jump here if anything goes wrong during the commit process.
*/
commit_abort:
sqlite3pager_rollback(pPager);
return rc; return rc;
} }