aboutsummaryrefslogtreecommitdiff
path: root/src/test_multiplex.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-07-08 17:02:57 +0000
committerdrh <drh@noemail.net>2011-07-08 17:02:57 +0000
commit6f25e89d27072d8abcd481e8e58176ebfd8ff63c (patch)
tree84bb5b4df0abaa06f29b8c6dca231c452298217b /src/test_multiplex.c
parentda79cf0cc9cc00588782f771b76b087460507586 (diff)
downloadsqlite-6f25e89d27072d8abcd481e8e58176ebfd8ff63c.tar.gz
sqlite-6f25e89d27072d8abcd481e8e58176ebfd8ff63c.zip
Change the default chunk size on test_multiplex.c to 2147418112 bytes
(formerly 1073741824 bytes) and make the default configurable at compile-time using SQLITE_MULTIPLEX_CHUNK_SIZE and at run-time using the "chunksize" URI query parameter. Add support fo test_multiplex to the shell. FossilOrigin-Name: e305b5a931374e2a1d2e66ea0a1248b9d4aecb19
Diffstat (limited to 'src/test_multiplex.c')
-rw-r--r--src/test_multiplex.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/test_multiplex.c b/src/test_multiplex.c
index f709c9a99..60ccbcc35 100644
--- a/src/test_multiplex.c
+++ b/src/test_multiplex.c
@@ -45,6 +45,7 @@
#include "sqlite3.h"
#include <string.h>
#include <assert.h>
+#include <stdlib.h>
#include "test_multiplex.h"
#ifndef SQLITE_CORE
@@ -78,20 +79,26 @@
/************************ Shim Definitions ******************************/
-#define SQLITE_MULTIPLEX_VFS_NAME "multiplex"
+#ifndef SQLITE_MULTIPLEX_VFS_NAME
+# define SQLITE_MULTIPLEX_VFS_NAME "multiplex"
+#endif
/* This is the limit on the chunk size. It may be changed by calling
** the xFileControl() interface. It will be rounded up to a
-** multiple of MAX_PAGE_SIZE. We default it here to 1GB.
+** multiple of MAX_PAGE_SIZE. We default it here to 2GiB less 64KiB.
*/
-#define SQLITE_MULTIPLEX_CHUNK_SIZE (MAX_PAGE_SIZE*16384)
+#ifndef SQLITE_MULTIPLEX_CHUNK_SIZE
+# define SQLITE_MULTIPLEX_CHUNK_SIZE 2147418112
+#endif
/* Default limit on number of chunks. Care should be taken
** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT
** format specifier. It may be changed by calling
** the xFileControl() interface.
*/
-#define SQLITE_MULTIPLEX_MAX_CHUNKS 32
+#ifndef SQLITE_MULTIPLEX_MAX_CHUNKS
+# define SQLITE_MULTIPLEX_MAX_CHUNKS 32
+#endif
/* If SQLITE_MULTIPLEX_EXT_OVWR is defined, the
** last SQLITE_MULTIPLEX_EXT_SZ characters of the
@@ -431,12 +438,18 @@ static int multiplexOpen(
}
if( rc==SQLITE_OK ){
+ const char *zChunkSize;
/* assign pointers to extra space allocated */
char *p = (char *)&pGroup[1];
pMultiplexOpen->pGroup = pGroup;
memset(pGroup, 0, sz);
pGroup->bEnabled = -1;
pGroup->nChunkSize = SQLITE_MULTIPLEX_CHUNK_SIZE;
+ zChunkSize = sqlite3_uri_parameter(zName, "chunksize");
+ if( zChunkSize ){
+ int n = atoi(zChunkSize);
+ if( n>0 ) pGroup->nChunkSize = (n+0xffff)&~0xffff;
+ }
pGroup->nMaxChunks = SQLITE_MULTIPLEX_MAX_CHUNKS;
pGroup->pReal = (sqlite3_file **)p;
p += (sizeof(sqlite3_file *)*pGroup->nMaxChunks);