1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Enhanced comments in wal.c and declare some procedure parameters "const".

No changes to the generated code.

FossilOrigin-Name: d0e4375b8a784d4e4ae66caababac919edd61883
This commit is contained in:
drh
2010-12-15 21:02:06 +00:00
parent 901e994b8b
commit d9c9b78e6c
3 changed files with 51 additions and 16 deletions

View File

@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hash: SHA1
C When\sregistering\sthe\sbuilt-in\sLIKE\sand\sGLOB\sfunctions,\smake\ssure\sthat\sthey\nare\stagged\swith\sSQLITE_UTF8\sso\sthat\sif\sother\sapplication-defined\sLIKE\sand\nGLOB\simplementations\sare\sprovided\sfor\sUTF16,\sthen\sthe\sappropriate\sfunction\nwill\sbe\sselected. C Enhanced\scomments\sin\swal.c\sand\sdeclare\ssome\sprocedure\sparameters\s"const".\nNo\schanges\sto\sthe\sgenerated\scode.
D 2010-12-15T18:54:37 D 2010-12-15T21:02:06
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 4547616ad2286053af6ccccefa242dc925e49bf0 F Makefile.in 4547616ad2286053af6ccccefa242dc925e49bf0
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -240,7 +240,7 @@ F src/vdbeblob.c 18955f0ee6b133cd08e1592010cb9a6b11e9984c
F src/vdbemem.c 411649a35686f54268ccabeda175322c4697f5a6 F src/vdbemem.c 411649a35686f54268ccabeda175322c4697f5a6
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c b297e8fa656ab5e66244ab15680d68db0adbec30 F src/vtab.c b297e8fa656ab5e66244ab15680d68db0adbec30
F src/wal.c f26b8d297bd11cb792e609917f9d4c6718ac8e0e F src/wal.c 1c846e56cb271675304c0152cea91f4c2ecf5111
F src/wal.h c1aac6593a0b02b15dc625987e619edeab39292e F src/wal.h c1aac6593a0b02b15dc625987e619edeab39292e
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c fa22d45b2577c77146f2e894d58011d472d64103 F src/where.c fa22d45b2577c77146f2e894d58011d472d64103
@@ -897,14 +897,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P fa37d8eb7cd8049689068af2a80fe2cbb4a603f1 P e1660764f20fed3fe92156d2b7f06075ff6ac145
R 54ccdc3adac00c10353f3a4344e22182 R 1109917c271937e015845cf31d3c184d
U drh U drh
Z d38e8f6227d017dae680c87b22026116 Z 64f2fa76dd6cb11cf7eb68fbbec80d5e
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux) Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFNCQ7woxKgR168RlERAhlXAJ0VoVIcQCG2JtRw00vlkdOF11cy9wCfVw49 iD8DBQFNCSzRoxKgR168RlERAuCpAJ9yUwv8k5HtKXw8KEgKm4OKZcQUiwCfRCV0
kGM8knNFe0ZkghKGrCrLrig= zLsoQIm1ng13QYFi6EqUsyY=
=6CjA =j104
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@@ -1 +1 @@
e1660764f20fed3fe92156d2b7f06075ff6ac145 d0e4375b8a784d4e4ae66caababac919edd61883

View File

@@ -458,14 +458,14 @@ typedef u16 ht_slot;
*/ */
struct WalIterator { struct WalIterator {
int iPrior; /* Last result returned from the iterator */ int iPrior; /* Last result returned from the iterator */
int nSegment; /* Size of the aSegment[] array */ int nSegment; /* Number of entries in aSegment[] */
struct WalSegment { struct WalSegment {
int iNext; /* Next slot in aIndex[] not yet returned */ int iNext; /* Next slot in aIndex[] not yet returned */
ht_slot *aIndex; /* i0, i1, i2... such that aPgno[iN] ascend */ ht_slot *aIndex; /* i0, i1, i2... such that aPgno[iN] ascend */
u32 *aPgno; /* Array of page numbers. */ u32 *aPgno; /* Array of page numbers. */
int nEntry; /* Max size of aPgno[] and aIndex[] arrays */ int nEntry; /* Nr. of entries in aPgno[] and aIndex[] */
int iZero; /* Frame number associated with aPgno[0] */ int iZero; /* Frame number associated with aPgno[0] */
} aSegment[1]; /* One for every 32KB page in the WAL */ } aSegment[1]; /* One for every 32KB page in the wal-index */
}; };
/* /*
@@ -1329,9 +1329,29 @@ static int walIteratorNext(
/* /*
** This function merges two sorted lists into a single sorted list. ** This function merges two sorted lists into a single sorted list.
**
** aLeft[] and aRight[] are arrays of indices. The sort key is
** aContent[aLeft[]] and aContent[aRight[]]. Upon entry, the following
** is guaranteed for all J<K:
**
** aContent[aLeft[J]] < aContent[aLeft[K]]
** aContent[aRight[J]] < aContent[aRight[K]]
**
** This routine overwrites aRight[] with a new (probably longer) sequence
** of indices such that the aRight[] contains every index that appears in
** either aLeft[] or the old aRight[] and such that the second condition
** above is still met.
**
** The aContent[aLeft[X]] values will be unique for all X. And the
** aContent[aRight[X]] values will be unique too. But there might be
** one or more combinations of X and Y such that
**
** aLeft[X]!=aRight[Y] && aContent[aLeft[X]] == aContent[aRight[Y]]
**
** When that happens, omit the aLeft[X] and use the aRight[Y] index.
*/ */
static void walMerge( static void walMerge(
u32 *aContent, /* Pages in wal */ const u32 *aContent, /* Pages in wal - keys for the sort */
ht_slot *aLeft, /* IN: Left hand input list */ ht_slot *aLeft, /* IN: Left hand input list */
int nLeft, /* IN: Elements in array *paLeft */ int nLeft, /* IN: Elements in array *paLeft */
ht_slot **paRight, /* IN/OUT: Right hand input list */ ht_slot **paRight, /* IN/OUT: Right hand input list */
@@ -1371,10 +1391,24 @@ static void walMerge(
} }
/* /*
** Sort the elements in list aList, removing any duplicates. ** Sort the elements in list aList using aContent[] as the sort key.
** Remove elements with duplicate keys, preferring to keep the
** larger aList[] values.
**
** The aList[] entries are indices into aContent[]. The values in
** aList[] are to be sorted so that for all J<K:
**
** aContent[aList[J]] < aContent[aList[K]]
**
** For any X and Y such that
**
** aContent[aList[X]] == aContent[aList[Y]]
**
** Keep the larger of the two values aList[X] and aList[Y] and discard
** the smaller.
*/ */
static void walMergesort( static void walMergesort(
u32 *aContent, /* Pages in wal */ const u32 *aContent, /* Pages in wal */
ht_slot *aBuffer, /* Buffer of at least *pnList items to use */ ht_slot *aBuffer, /* Buffer of at least *pnList items to use */
ht_slot *aList, /* IN/OUT: List to sort */ ht_slot *aList, /* IN/OUT: List to sort */
int *pnList /* IN/OUT: Number of elements in aList[] */ int *pnList /* IN/OUT: Number of elements in aList[] */
@@ -1439,6 +1473,7 @@ static void walIteratorFree(WalIterator *p){
/* /*
** Construct a WalInterator object that can be used to loop over all ** Construct a WalInterator object that can be used to loop over all
** pages in the WAL in ascending order. The caller must hold the checkpoint ** pages in the WAL in ascending order. The caller must hold the checkpoint
** lock.
** **
** On success, make *pp point to the newly allocated WalInterator object ** On success, make *pp point to the newly allocated WalInterator object
** return SQLITE_OK. Otherwise, return an error code. If this routine ** return SQLITE_OK. Otherwise, return an error code. If this routine