1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

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
This commit is contained in:
drh
2011-12-15 13:29:12 +00:00
parent 31b21295b0
commit 78c0eafb35
3 changed files with 18 additions and 8 deletions

View File

@@ -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 ){