aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-12-15 13:29:12 +0000
committerdrh <drh@noemail.net>2011-12-15 13:29:12 +0000
commit78c0eafb3535fd70d74b9753b4e52f7a6225b5a2 (patch)
treed66124b5eb3c08c5fca9d6d35b31fefe391a89a7 /src
parent31b21295b0f291b2e4f37442b687672e1feffac3 (diff)
downloadsqlite-78c0eafb3535fd70d74b9753b4e52f7a6225b5a2.tar.gz
sqlite-78c0eafb3535fd70d74b9753b4e52f7a6225b5a2.zip
Make sure the chunksize in test_multiplex does not cause the pending byte
to fall near the end of a chunk. Adjust the chunksize upward as necessary to prevent this. FossilOrigin-Name: e05f8a2998f4f4cbdb65702baa65893c538b3d38
Diffstat (limited to 'src')
-rw-r--r--src/test_multiplex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test_multiplex.c b/src/test_multiplex.c
index f0d495f49..12e420fb5 100644
--- a/src/test_multiplex.c
+++ b/src/test_multiplex.c
@@ -462,6 +462,16 @@ static int multiplexOpen(
memcpy(pGroup->zName, zName, nName+1);
pGroup->nName = nName;
}
+ if( pGroup->bEnabled ){
+ /* Make sure that the chunksize is not such that the pending byte
+ ** falls at the end of a chunk. A region of up to 64K following
+ ** the pending byte is never written, so if the pending byte occurs
+ ** near the end of a chunk, that chunk will be too small. */
+ extern int sqlite3PendingByte;
+ while( (sqlite3PendingByte % pGroup->szChunk)>=(pGroup->szChunk-65536) ){
+ pGroup->szChunk += 65536;
+ }
+ }
pGroup->flags = flags;
rc = multiplexSubFilename(pGroup, 1);
if( rc==SQLITE_OK ){