Fix many minor issues in the unlocked transaction code.
FossilOrigin-Name: 53aaeea6c98f82f3b55d4b3ab139ee41b727243c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
C When\scommitting\san\sUNLOCKED\stransaction,\stry\sto\smove\spages\sallocated\sat\sthe\send\sof\sthe\sfile\sto\sfree\sslots\swithin\sthe\sfile\s(like\san\sincremental-vacuum\soperation\sdoes).
|
||||
D 2015-08-21T18:55:22.935
|
||||
C Fix\smany\sminor\sissues\sin\sthe\sunlocked\stransaction\scode.
|
||||
D 2015-08-21T20:11:23.106
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 4f663b6b4954b9b1eb0e6f08387688a93b57542d
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@@ -278,7 +278,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
||||
F src/backup.c 4d9134dc988a87838c06056c89c0e8c4700a0452
|
||||
F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d
|
||||
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
||||
F src/btree.c e455c3dbe8534aae357eab8ede1e280b6e838af0
|
||||
F src/btree.c dc80ac8374105e3caf298a6533e3312101691330
|
||||
F src/btree.h 00d4cdb747c4172a5566faf037116985dbbc377e
|
||||
F src/btreeInt.h 1f7258e1f35ba3cc2197f9019f523dd20d59a0d8
|
||||
F src/build.c e47b6fffe14a28d9050e6747beebb01597d37542
|
||||
@@ -301,7 +301,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
||||
F src/lempar.c 92bafa308607dd985ca389a788cd9e0a2b608712
|
||||
F src/loadext.c dfcee8c7c032cd0fd55af3e0fc1fcfb01e426df2
|
||||
F src/main.c f4a8a75649073b85048505e2bdda4419936d9eb6
|
||||
F src/main.c e17fcffae4306a9b8334faf3bac80d7396850b54
|
||||
F src/malloc.c 19461e159bccf0e2cf06a50e867963d0a7b124a8
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987
|
||||
@@ -323,8 +323,8 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c 388c023582b17890f10c980b30ec1922b471753b
|
||||
F src/os_win.c 40b3af7a47eb1107d0d69e592bec345a3b7b798a
|
||||
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c 48a76f16a75112c9b064e21e1d1ecf0b4d87b5cd
|
||||
F src/pager.h 3fc23bca2e7d606ca4fbdd923713cdcdcec48297
|
||||
F src/pager.c 951b7bae30fcbc2a2d380fa68f8bc68286ae0760
|
||||
F src/pager.h 1e7b0fc3846b71bd95b4b3300820d756895cb4ef
|
||||
F src/parse.y e9accdb2cb1795f75f478e7ce89e17b19d7d4da7
|
||||
F src/pcache.c cde06aa50962595e412d497e22fd2e07878ba1f0
|
||||
F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9
|
||||
@@ -398,20 +398,20 @@ F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f
|
||||
F src/update.c 487747b328b7216bb7f6af0695d6937d5c9e605f
|
||||
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
|
||||
F src/util.c bc9dd64b5db544218b871b66243871c202b2781f
|
||||
F src/vacuum.c 4e7e18d889662eda281855a7125e56269069f215
|
||||
F src/vacuum.c d35c7291e94a470ee47695c22559a69aef9fdda1
|
||||
F src/vdbe.c 97b07a1af65971dab3d326742e912ac8c12108dd
|
||||
F src/vdbe.h 7a75045d879118b9d3af7e8b3c108f2f27c51473
|
||||
F src/vdbeInt.h 8b54e01ad0463590e7cffabce0bc36da9ee4f816
|
||||
F src/vdbeapi.c bda74ef4b5103d7b4a4be36f936d3cf2b56a7d6f
|
||||
F src/vdbeaux.c 0d62c6c2522d4a04e051d3862dfe7ae2f5c95598
|
||||
F src/vdbeaux.c 4fae90f55736b7537d0fcd2afe52849edbbb7ecd
|
||||
F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
|
||||
F src/vdbemem.c ae38a0d35ae71cf604381a887c170466ba518090
|
||||
F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b
|
||||
F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0
|
||||
F src/vtab.c d31174e4c8f592febab3fa7f69e18320b4fd657a
|
||||
F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
||||
F src/wal.c 37b25bbb52d6a736397d11e85068b1a496970fb2
|
||||
F src/wal.h 5aaed8ca6cad1406088042ff8767951a6a3c7b56
|
||||
F src/wal.c 0ba4899f02457be91fe5bc734638fee00c807f64
|
||||
F src/wal.h a701096b9bf5761b8c5f4b07082249e1950afc9a
|
||||
F src/walker.c 2e14d17f592d176b6dc879c33fbdec4fbccaa2ba
|
||||
F src/where.c 66518a14a1238611aa0744d6980b6b7f544f4816
|
||||
F src/whereInt.h 880a8599226ac1c00203490d934f3ed79b292572
|
||||
@@ -1378,7 +1378,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 227bb8a1815c4dc6084970f06b0a6bfccdff3fd2
|
||||
R 59f0ca349927e5f594c9b22ba4f42852
|
||||
P 069679162d8d50e9731831e658aa58f280dbb3e7
|
||||
R 98654e6b793f843bd7dce43cd408dae9
|
||||
U dan
|
||||
Z 06941d0e9b57ce8c4c11e26554097e38
|
||||
Z 8f0a71142a3eb918cc8670c51bd39224
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
069679162d8d50e9731831e658aa58f280dbb3e7
|
||||
53aaeea6c98f82f3b55d4b3ab139ee41b727243c
|
||||
+1
-1
@@ -3906,8 +3906,8 @@ static int btreeFixUnlocked(Btree *p){
|
||||
Pgno iLast = MIN(nPage, nHPage); /* Last page to move */
|
||||
Pgno iPg;
|
||||
Pgno nCurrent; /* Current size of db */
|
||||
|
||||
nCurrent = MAX(nPage, nHPage);
|
||||
|
||||
for(iPg=pMap->iFirst; iPg<=iLast && rc==SQLITE_OK; iPg++){
|
||||
MemPage *pPg = 0;
|
||||
Pgno iNew; /* New page number for pPg */
|
||||
|
||||
@@ -2744,7 +2744,6 @@ static int openDatabase(
|
||||
memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
|
||||
db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;
|
||||
db->autoCommit = 1;
|
||||
db->bUnlocked = 0;
|
||||
db->nextAutovac = -1;
|
||||
db->szMmap = sqlite3GlobalConfig.szMmap;
|
||||
db->nextPagesize = 0;
|
||||
|
||||
+1
-4
@@ -5631,8 +5631,6 @@ int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){
|
||||
pPager->pAllRead = sqlite3BitvecCreate(pPager->dbSize);
|
||||
if( pPager->pAllRead==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3BitvecSet(pPager->pAllRead, 1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -6155,8 +6153,7 @@ void sqlite3PagerDropExclusiveLock(Pager *pPager){
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if this is a WAL database and snapshot upgrade is required
|
||||
** before the current transaction can be committed.
|
||||
** Return true if this pager is currently within an UNLOCKED transaction.
|
||||
*/
|
||||
int sqlite3PagerIsUnlocked(Pager *pPager){
|
||||
return pPager->pAllRead!=0;
|
||||
|
||||
+2
-3
@@ -145,7 +145,6 @@ int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
|
||||
int sqlite3PagerPageRefcount(DbPage*);
|
||||
void *sqlite3PagerGetData(DbPage *);
|
||||
void *sqlite3PagerGetExtra(DbPage *);
|
||||
int sqlite3PagerIsDirty(DbPage*);
|
||||
|
||||
/* Functions used to manage pager transactions and savepoints. */
|
||||
void sqlite3PagerPagecount(Pager*, int*);
|
||||
@@ -159,8 +158,6 @@ int sqlite3PagerOpenSavepoint(Pager *pPager, int n);
|
||||
int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);
|
||||
int sqlite3PagerSharedLock(Pager *pPager);
|
||||
|
||||
void sqlite3PagerDropExclusiveLock(Pager*);
|
||||
int sqlite3PagerIsUnlocked(Pager*);
|
||||
|
||||
#ifndef SQLITE_OMIT_WAL
|
||||
int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int*);
|
||||
@@ -197,6 +194,8 @@ void sqlite3PagerTruncateImage(Pager*,Pgno);
|
||||
|
||||
void sqlite3PagerRekey(DbPage*, Pgno, u16);
|
||||
|
||||
void sqlite3PagerDropExclusiveLock(Pager*);
|
||||
int sqlite3PagerIsUnlocked(Pager*);
|
||||
int sqlite3PagerIswriteable(DbPage*);
|
||||
int sqlite3PagerUpgradeSnapshot(Pager *pPager, DbPage*);
|
||||
void sqlite3PagerSetDbsize(Pager *pPager, Pgno);
|
||||
|
||||
+1
-1
@@ -356,7 +356,7 @@ end_of_vacuum:
|
||||
** is closed by the DETACH.
|
||||
*/
|
||||
db->autoCommit = 1;
|
||||
db->bUnlocked = 0;
|
||||
assert( db->bUnlocked==0 );
|
||||
|
||||
if( pDb ){
|
||||
sqlite3BtreeClose(pDb->pBt);
|
||||
|
||||
+1
-1
@@ -2571,7 +2571,7 @@ int sqlite3VdbeHalt(Vdbe *p){
|
||||
}
|
||||
|
||||
assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 );
|
||||
return ((p->rc & 0xFF)==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);
|
||||
return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2671,25 +2671,6 @@ void sqlite3WalUpgradeSnapshot(Wal *pWal){
|
||||
memcpy(&pWal->hdr, (void*)walIndexHdr(pWal), sizeof(WalIndexHdr));
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is only ever called while committing an UNLOCKED
|
||||
** transaction, after the caller has already obtained the WRITER lock
|
||||
** (by calling the sqlite3WalLockForCommit() routine). This function
|
||||
** returns true if the transaction was prepared against a database
|
||||
** snapshot older than the current head of the wal file.
|
||||
**
|
||||
** Note that this will only work as described if the database is
|
||||
** currently executing an UNLOCKED transaction, as it assumes that
|
||||
** pWal->hdr has not been modified since the beginning of the
|
||||
** transaction. This may not be true for a non-UNLOCKED transaction,
|
||||
** as pWal->hdr is updated if any pages are spilled to the wal file
|
||||
** while the transaction is executing.
|
||||
*/
|
||||
int sqlite3WalCommitRequiresUpgrade(Wal *pWal){
|
||||
assert( pWal->writeLock );
|
||||
return memcmp(&pWal->hdr, (void*)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0;
|
||||
}
|
||||
|
||||
/*
|
||||
** End a write transaction. The commit has already been done. This
|
||||
** routine merely releases the lock.
|
||||
|
||||
@@ -126,9 +126,7 @@ int sqlite3WalExclusiveMode(Wal *pWal, int op);
|
||||
*/
|
||||
int sqlite3WalHeapMemory(Wal *pWal);
|
||||
|
||||
/* Return true if the WRITER lock is held. False otherwise. */
|
||||
int sqlite3WalLockForCommit(Wal *pWal, PgHdr *pPg, Bitvec *pRead);
|
||||
int sqlite3WalCommitRequiresUpgrade(Wal *pWal);
|
||||
void sqlite3WalUpgradeSnapshot(Wal *pWal);
|
||||
|
||||
#ifdef SQLITE_ENABLE_ZIPVFS
|
||||
|
||||
Reference in New Issue
Block a user