From: drh Date: Tue, 1 Jun 2010 01:08:08 +0000 (+0000) Subject: Comment edits and cleanup in wal.c. No functional code changes. X-Git-Tag: version-3.7.2~328^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=181e091ff38f3fa958b2df74aa3b369c19390fe4;p=thirdparty%2Fsqlite.git Comment edits and cleanup in wal.c. No functional code changes. FossilOrigin-Name: e8e666ab8273f5db5265f0773b39820f75b6df1a --- diff --git a/manifest b/manifest index 16b6c1f177..4c44723b0d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Attempt\sto\sget\sthe\sfilectrl.test\sscript\srunning. -D 2010-06-01T00:28:43 +C Comment\sedits\sand\scleanup\sin\swal.c.\s\sNo\sfunctional\scode\schanges. +D 2010-06-01T01:08:09 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -224,7 +224,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 b3f312fe54d298f965de98870af9eae0c5829310 +F src/wal.c d03eebb92e496ef6d4bd15d366bea2ee28e7fd8c F src/wal.h 1c1c9feb629b7f4afcbe0b47f80f47c5551d3a02 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356 @@ -815,7 +815,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P bc707c83e5f9849d9d201d695d0d071ca9ed93cb -R ae102866b2fd164e7001ff9fe230b9d8 +P e46a8f2b752f86c4d8942ee125210516026ffdc2 +R 09bc5e191ce3f59e21c41c3724d44527 U drh -Z ebdd27e86d236f32028490bc4dcd2173 +Z 50c2b0464eb7589c438f6f5d9973cb2c diff --git a/manifest.uuid b/manifest.uuid index 127181b163..5dc4c3e42a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e46a8f2b752f86c4d8942ee125210516026ffdc2 \ No newline at end of file +e8e666ab8273f5db5265f0773b39820f75b6df1a \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 99d884c463..0a67de59d5 100644 --- a/src/wal.c +++ b/src/wal.c @@ -595,7 +595,8 @@ static int walDecodeFrame( #if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) /* -** Names of locks. +** Names of locks. This routine is used to provide debugging output and is not +** a part of an ordinary build. */ static const char *walLockName(int lockIdx){ if( lockIdx==WAL_WRITE_LOCK ){ @@ -615,7 +616,9 @@ static const char *walLockName(int lockIdx){ /* -** Set or release locks. +** Set or release locks on the WAL. Locks are either shared or exclusive. +** A lock cannot be moved directly between shared and exclusive - it must go +** through the unlocked state first. ** ** In locking_mode=EXCLUSIVE, all of these routines become no-ops. */ @@ -674,10 +677,10 @@ static int walIndexEntry(u32 iFrame){ } /* -** Return the minimum mapping size in bytes that can be used to read the -** wal-index up to and including frame iFrame. If iFrame is the last frame -** in a block of 256 frames, the returned byte-count includes the space -** required by the 256-byte index block. +** Return the minimum size of the shared-memory, in bytes, that is needed +** to support a wal-index containing frame iFrame. The value returned +** includes the wal-index header and the complete "block" containing iFrame, +** including the hash table segment that follows the block. */ static int walMappingSize(u32 iFrame){ const int nByte = (sizeof(u32)*HASHTABLE_NPAGE + HASHTABLE_NBYTE) ; @@ -743,7 +746,8 @@ static int walIndexRemap(Wal *pWal, int enlargeTo){ /* ** Compute a hash on a page number. The resulting hash value must land -** between 0 and (HASHTABLE_NSLOT-1). +** between 0 and (HASHTABLE_NSLOT-1). The walHashNext() function advances +** the hash to the next value in the event of a collision. */ static int walHash(u32 iPage){ assert( iPage>0 ); @@ -806,9 +810,10 @@ static void walHashFind( ** This function is called whenever pWal->hdr.mxFrame is decreased due ** to a rollback or savepoint. ** -** At most only the very last hash table needs to be updated. Any -** later hash tables will be automatically cleared when pWal->hdr.mxFrame -** advances to the point where those hash tables are actually needed. +** At most only the hash table containing pWal->hdr.mxFrame needs to be +** updated. Any later hash tables will be automatically cleared when +** pWal->hdr.mxFrame advances to the point where those hash tables are +** actually needed. */ static void walCleanupHash(Wal *pWal){ volatile HASHTABLE_DATATYPE *aHash; /* Pointer to hash table to clear */ @@ -1089,14 +1094,12 @@ static void walIndexClose(Wal *pWal, int isDelete){ } /* -** Open a connection to the log file associated with database zDb. The -** database file does not actually have to exist. zDb is used only to -** figure out the name of the log file to open. If the log file does not -** exist it is created by this call. +** Open a connection to the WAL file associated with database zDbName. +** The database file must already be opened on connection pDbFd. ** ** A SHARED lock should be held on the database file when this function ** is called. The purpose of this SHARED lock is to prevent any other -** client from unlinking the log or wal-index file. If another process +** client from unlinking the WAL or wal-index file. If another process ** were to do this just after this client opened one of these files, the ** system would be badly broken. **