-C For\san\sexisting\smultiplexed\sdatabase,\stry\sto\sset\sthe\schunk\ssize\sautomatically\nbased\son\sthe\ssizes\sof\sthe\spreexisting\spieces.
-D 2011-07-20T17:59:38.568
+C All\smultiplexor\schunk\ssizes\sup\sto\s4GiB.\s\sDisable\sthe\smultiplexor\sif\sthe\nchunk\ssize\sis\sset\sto\s0.
+D 2011-07-21T20:59:58.248
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6
-F src/test_multiplex.c 7f5b2ec63ff514f12e95ffbe134fca87eaac7e96
+F src/test_multiplex.c 991a60733dbde8c529043d466c5c44d180762561
F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3
F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33
-F test/multiplex.test 2256e90e8780de6eeafc07d4084427c3a97d3bcb
+F test/multiplex.test b45367b1dac7dfa4c5b8ff0f3844260804a0034d
F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test dc212a22b36109fd1ae37154292444ef249c5ec2
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
-P 29866f9598502a007816410fade34f1d0952dea0
-R f7447480ebd05c67794755dbb19b5608
+P 427a9a5120a68bfa12fec97cfd02eb9b28b3fa6b
+R 046ebc91a200dc382cece52b5754a0c1
U drh
-Z ce5790e6bda5ced4f7371ad338df0dcd
+Z 032caca1acf96a44c6601a79dc41d32f
char *zName; /* Base filename of this group */
int nName; /* Length of base filename */
int flags; /* Flags used for original opening */
- int nChunkSize; /* Chunk size used for this group */
+ unsigned int szChunk; /* Chunk size used for this group */
int bEnabled; /* TRUE to use Multiplex VFS for this file */
multiplexGroup *pNext, *pPrev; /* Doubly linked list of all group objects */
};
}
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;
+ pGroup->szChunk = SQLITE_MULTIPLEX_CHUNK_SIZE;
if( flags & SQLITE_OPEN_URI ){
+ const char *zChunkSize;
zChunkSize = sqlite3_uri_parameter(zName, "chunksize");
if( zChunkSize ){
- int n = atoi(zChunkSize);
- if( n>0 ) pGroup->nChunkSize = (n+0xffff)&~0xffff;
+ unsigned int n = 0;
+ int i;
+ for(i=0; zChunkSize[i]>='0' && zChunkSize[i]<='9'; i++){
+ n = n*10 + zChunkSize[i] - '0';
+ }
+ if( n>0 ){
+ pGroup->szChunk = (n+0xffff)&~0xffff;
+ }else{
+ /* A zero or negative chunksize disabled the multiplexor */
+ pGroup->bEnabled = 0;
+ }
}
}
pGroup->zName = p;
rc3 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z,
SQLITE_ACCESS_EXISTS, &exists);
if( rc3==SQLITE_OK && exists && sz==(sz&0xffff0000) && sz>0
- && sz!=pGroup->nChunkSize ){
- pGroup->nChunkSize = sz;
- }else if( rc3==SQLITE_OK && !exists && sz>pGroup->nChunkSize ){
+ && sz!=pGroup->szChunk ){
+ pGroup->szChunk = sz;
+ }else if( rc3==SQLITE_OK && !exists && sz>pGroup->szChunk ){
pGroup->bEnabled = 0;
}
}
}
}else{
while( iAmt > 0 ){
- int i = (int)(iOfst / pGroup->nChunkSize);
+ int i = (int)(iOfst / pGroup->szChunk);
sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL);
if( pSubOpen ){
- int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) -
- pGroup->nChunkSize;
+ int extra = ((int)(iOfst % pGroup->szChunk) + iAmt) - pGroup->szChunk;
if( extra<0 ) extra = 0;
iAmt -= extra;
rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt,
- iOfst % pGroup->nChunkSize);
+ iOfst % pGroup->szChunk);
if( rc!=SQLITE_OK ) break;
pBuf = (char *)pBuf + iAmt;
iOfst += iAmt;
}
}else{
while( iAmt > 0 ){
- int i = (int)(iOfst / pGroup->nChunkSize);
+ int i = (int)(iOfst / pGroup->szChunk);
sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL);
if( pSubOpen ){
- int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) -
- pGroup->nChunkSize;
+ int extra = ((int)(iOfst % pGroup->szChunk) + iAmt) -
+ pGroup->szChunk;
if( extra<0 ) extra = 0;
iAmt -= extra;
rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt,
- iOfst % pGroup->nChunkSize);
+ iOfst % pGroup->szChunk);
if( rc!=SQLITE_OK ) break;
pBuf = (char *)pBuf + iAmt;
iOfst += iAmt;
sqlite3_file *pSubOpen;
sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */
/* delete the chunks above the truncate limit */
- for(i=(int)(size / pGroup->nChunkSize)+1; i<pGroup->nReal; i++){
+ for(i=(int)(size / pGroup->szChunk)+1; i<pGroup->nReal; i++){
multiplexSubClose(pGroup, i, pOrigVfs);
}
- pSubOpen = multiplexSubOpen(pGroup, (int)(size/pGroup->nChunkSize), &rc2,0);
+ pSubOpen = multiplexSubOpen(pGroup, (int)(size/pGroup->szChunk), &rc2,0);
if( pSubOpen ){
- rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->nChunkSize);
+ rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->szChunk);
if( rc2!=SQLITE_OK ) rc = rc2;
}else{
rc = SQLITE_IOERR_TRUNCATE;
if( rc2!=SQLITE_OK ){
rc = rc2;
}else{
- if( sz>pGroup->nChunkSize ){
+ if( sz>pGroup->szChunk ){
rc = SQLITE_IOERR_FSTAT;
}
*pSize += sz;
break;
case MULTIPLEX_CTRL_SET_CHUNK_SIZE:
if( pArg ) {
- int nChunkSize = *(int *)pArg;
- if( nChunkSize<1 ){
+ unsigned int szChunk = *(unsigned*)pArg;
+ if( szChunk<1 ){
rc = SQLITE_MISUSE;
}else{
/* Round up to nearest multiple of MAX_PAGE_SIZE. */
- nChunkSize = (nChunkSize + (MAX_PAGE_SIZE-1));
- nChunkSize &= ~(MAX_PAGE_SIZE-1);
- pGroup->nChunkSize = nChunkSize;
+ szChunk = (szChunk + (MAX_PAGE_SIZE-1));
+ szChunk &= ~(MAX_PAGE_SIZE-1);
+ pGroup->szChunk = szChunk;
rc = SQLITE_OK;
}
}
Tcl_NewIntObj(nChunks));
Tcl_ListObjAppendElement(interp, pGroupTerm,
- Tcl_NewIntObj(pGroup->nChunkSize));
+ Tcl_NewIntObj(pGroup->szChunk));
Tcl_ListObjAppendElement(interp, pGroupTerm,
Tcl_NewIntObj(pGroup->nReal));
do_test multiplex-1.9.2 { sqlite3 db test.db } {}
do_test multiplex-1.9.3 { multiplex_set db main 32768 16 } {SQLITE_OK}
do_test multiplex-1.9.4 { multiplex_set db main 32768 -1 } {SQLITE_OK}
-do_test multiplex-1.9.5 { multiplex_set db main -1 16 } {SQLITE_MISUSE}
do_test multiplex-1.9.6 { multiplex_set db main 31 16 } {SQLITE_OK}
do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_OK}
do_test multiplex-1.9.8 { multiplex_set db main 1073741824 1 } {SQLITE_OK}
do_test multiplex-1.10.2 { sqlite3 db test.db } {}
do_test multiplex-1.10.3 { lindex [ catchsql { SELECT multiplex_control(2, 32768); } ] 0 } {0}
do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {0}
-do_test multiplex-1.10.5 { lindex [ catchsql { SELECT multiplex_control(2, -1); } ] 0 } {1}
do_test multiplex-1.10.6 { lindex [ catchsql { SELECT multiplex_control(2, 31); } ] 0 } {0}
do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {0}
do_test multiplex-1.10.8 { lindex [ catchsql { SELECT multiplex_control(2, 1073741824); } ] 0 } {0}