diff options
author | dan <dan@noemail.net> | 2010-04-30 16:24:46 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-04-30 16:24:46 +0000 |
commit | 30c8629e67373a08c60bf7cc89c39ec7e30809d6 (patch) | |
tree | 432c34484b542b00b9488ab89631d66b36c70add | |
parent | 6ddb4bf938221cc7a8932fdcf071b3604d15ea75 (diff) | |
download | sqlite-30c8629e67373a08c60bf7cc89c39ec7e30809d6.tar.gz sqlite-30c8629e67373a08c60bf7cc89c39ec7e30809d6.zip |
Reapply commits [837d82a929] and [c05e7dca17] that were accidentally overwritten.
FossilOrigin-Name: 598de52700ba13e3228289220a74fc62073c62d4
-rw-r--r-- | manifest | 12 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/wal.c | 44 |
3 files changed, 51 insertions, 7 deletions
@@ -1,5 +1,5 @@ -C Add\sxShmXXX()\smethods\sto\sthe\stest\sVFS\sin\stest_devsym.test. -D 2010-04-30T16:19:40 +C Reapply\scommits\s[837d82a929]\sand\s[c05e7dca17]\sthat\swere\saccidentally\soverwritten. +D 2010-04-30T16:24:46 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -221,7 +221,7 @@ F src/vdbeblob.c 5327132a42a91e8b7acfb60b9d2c3b1c5c863e0e F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda -F src/wal.c f08889611d5da7d2cbe9557748e74f70ab454974 +F src/wal.c efe21d703cd5f32c18fd87762b6ac20dc47c5785 F src/wal.h c3f347ba8f1cde46d9bcc6fedaf3ed0aa4b53294 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c faadd9c2bf08868e5135192b44e0d753e363a885 @@ -808,7 +808,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P d9250e84ac1fc6590f8670e1d801630650c7846a -R e706456f30289526a342dac546a83543 +P 1d20342424b452ea96aaf161de1f98f26a9155a0 +R 88f12ad5a621dbb661d799113c2782f7 U dan -Z 9513429a159541b5d8980cb57914a083 +Z 72810ce2ab0ab749da9f7335fd238964 diff --git a/manifest.uuid b/manifest.uuid index 0bfe58ee6..914344034 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d20342424b452ea96aaf161de1f98f26a9155a0
\ No newline at end of file +598de52700ba13e3228289220a74fc62073c62d4
\ No newline at end of file @@ -784,8 +784,35 @@ int sqlite3WalClose( ){ int rc = SQLITE_OK; if( pWal ){ + int isDelete = 0; /* True to unlink wal and wal-index files */ + + /* If an EXCLUSIVE lock can be obtained on the database file (using the + ** ordinary, rollback-mode locking methods, this guarantees that the + ** connection associated with this log file is the only connection to + ** the database. In this case checkpoint the database and unlink both + ** the wal and wal-index files. + ** + ** The EXCLUSIVE lock is not released before returning. + */ + rc = sqlite3OsLock(pFd, SQLITE_LOCK_EXCLUSIVE); + if( rc==SQLITE_OK ){ + rc = walCheckpoint(pWal, pFd, sync_flags, zBuf); + if( rc==SQLITE_OK ){ + isDelete = 1; + } + walIndexUnmap(pWal); + } + pWal->pVfs->xShmClose(pWal->pWIndex); sqlite3OsClose(pWal->pFd); + if( isDelete ){ + int nWal; + char *zWal = &((char *)pWal->pFd)[pWal->pVfs->szOsFile]; + sqlite3OsDelete(pWal->pVfs, zWal, 0); + nWal = sqlite3Strlen30(zWal); + memcpy(&zWal[nWal], "-index", 7); + pWal->pVfs->xShmDelete(pWal->pVfs, zWal); + } sqlite3_free(pWal); } return rc; @@ -1008,6 +1035,23 @@ int sqlite3WalWriteLock(Wal *pWal, int op){ if( op ){ assert( pWal->lockState == SQLITE_SHM_READ ); rc = walSetLock(pWal, SQLITE_SHM_WRITE); + + /* If this connection is not reading the most recent database snapshot, + ** it is not possible to write to the database. In this case release + ** the write locks and return SQLITE_BUSY. + */ + if( rc==SQLITE_OK ){ + rc = walIndexMap(pWal, -1); + if( rc==SQLITE_OK + && memcmp(&pWal->hdr, pWal->pWiData, sizeof(WalIndexHdr)) + ){ + rc = SQLITE_BUSY; + } + walIndexUnmap(pWal); + if( rc!=SQLITE_OK ){ + walSetLock(pWal, SQLITE_SHM_READ); + } + } }else if( pWal->lockState==SQLITE_SHM_WRITE ){ rc = walSetLock(pWal, SQLITE_SHM_READ); } |