/ Check-in [e305b5a9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e305b5a931374e2a1d2e66ea0a1248b9d4aecb19
User & Date: drh 2011-07-08 17:02:57
Context
2011-07-09
13:00
In where.c::findIndexCol - make sure that the Expr.op is TK_COLUMN before accessing the Expr.iColumn and Expr.iTable fields. Also fix a couple of unreachable branches. check-in: 418a4da2 user: drh tags: trunk
2011-07-08
17:02
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. check-in: e305b5a9 user: drh tags: trunk
16:10
Fix for [54844eea3f]: Do not create automatic indexes on correlated sub-queries. check-in: 9f14fa56 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  2628   2628     "   -stats               print memory stats before each finalize\n"
  2629   2629     "   -nullvalue 'text'    set text string for NULL values\n"
  2630   2630     "   -version             show SQLite version\n"
  2631   2631     "   -vfs NAME            use NAME as the default VFS\n"
  2632   2632   #ifdef SQLITE_ENABLE_VFSTRACE
  2633   2633     "   -vfstrace            enable tracing of all VFS calls\n"
  2634   2634   #endif
         2635  +#ifdef SQLITE_ENABLE_MULTIPLEX
         2636  +  "   -multiplex           enable the multiplexor VFS\n"
         2637  +#endif
  2635   2638   ;
  2636   2639   static void usage(int showDetail){
  2637   2640     fprintf(stderr,
  2638   2641         "Usage: %s [OPTIONS] FILENAME [SQL]\n"  
  2639   2642         "FILENAME is the name of an SQLite database. A new database is created\n"
  2640   2643         "if the file does not previously exist.\n", Argv0);
  2641   2644     if( showDetail ){
................................................................................
  2729   2732            const char *zOldVfsName,
  2730   2733            int (*xOut)(const char*,void*),
  2731   2734            void *pOutArg,
  2732   2735            int makeDefault
  2733   2736         );
  2734   2737         vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
  2735   2738   #endif
         2739  +#ifdef SQLITE_ENABLE_MULTIPLEX
         2740  +    }else if( strcmp(argv[i],"-multiplex")==0 ){
         2741  +      extern int sqlite3_multiple_initialize(const char*,int);
         2742  +      sqlite3_multiplex_initialize(0, 1);
         2743  +#endif
  2736   2744       }else if( strcmp(argv[i],"-vfs")==0 ){
  2737   2745         sqlite3_vfs *pVfs = sqlite3_vfs_find(argv[++i]);
  2738   2746         if( pVfs ){
  2739   2747           sqlite3_vfs_register(pVfs, 1);
  2740   2748         }else{
  2741   2749           fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
  2742   2750           exit(1);
................................................................................
  2847   2855         stdin_is_interactive = 1;
  2848   2856       }else if( strcmp(z,"-batch")==0 ){
  2849   2857         stdin_is_interactive = 0;
  2850   2858       }else if( strcmp(z,"-heap")==0 ){
  2851   2859         i++;
  2852   2860       }else if( strcmp(z,"-vfs")==0 ){
  2853   2861         i++;
         2862  +#ifdef SQLITE_ENABLE_VFSTRACE
  2854   2863       }else if( strcmp(z,"-vfstrace")==0 ){
  2855   2864         i++;
         2865  +#endif
         2866  +#ifdef SQLITE_ENABLE_MULTIPLEX
         2867  +    }else if( strcmp(z,"-multiplex")==0 ){
         2868  +      i++;
         2869  +#endif
  2856   2870       }else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
  2857   2871         usage(1);
  2858   2872       }else{
  2859   2873         fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
  2860   2874         fprintf(stderr,"Use -help for a list of options.\n");
  2861   2875         return 1;
  2862   2876       }

Changes to src/test_multiplex.c.

    41     41   ** The multiplex VFS allows databases up to 32 GiB in size.  But it splits
    42     42   ** the files up into 1 GiB pieces, so that they will work even on filesystems
    43     43   ** that do not support large files.
    44     44   */
    45     45   #include "sqlite3.h"
    46     46   #include <string.h>
    47     47   #include <assert.h>
           48  +#include <stdlib.h>
    48     49   #include "test_multiplex.h"
    49     50   
    50     51   #ifndef SQLITE_CORE
    51     52     #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */
    52     53   #endif
    53     54   #include "sqlite3ext.h"
    54     55   
................................................................................
    74     75   #define sqlite3_mutex_held(X)     ((void)(X),1)
    75     76   #define sqlite3_mutex_notheld(X)  ((void)(X),1)
    76     77   #endif /* SQLITE_THREADSAFE==0 */
    77     78   
    78     79   
    79     80   /************************ Shim Definitions ******************************/
    80     81   
    81         -#define SQLITE_MULTIPLEX_VFS_NAME "multiplex"
           82  +#ifndef SQLITE_MULTIPLEX_VFS_NAME
           83  +# define SQLITE_MULTIPLEX_VFS_NAME "multiplex"
           84  +#endif
    82     85   
    83     86   /* This is the limit on the chunk size.  It may be changed by calling
    84     87   ** the xFileControl() interface.  It will be rounded up to a 
    85         -** multiple of MAX_PAGE_SIZE.  We default it here to 1GB.
           88  +** multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
    86     89   */
    87         -#define SQLITE_MULTIPLEX_CHUNK_SIZE (MAX_PAGE_SIZE*16384)
           90  +#ifndef SQLITE_MULTIPLEX_CHUNK_SIZE
           91  +# define SQLITE_MULTIPLEX_CHUNK_SIZE 2147418112
           92  +#endif
    88     93   
    89     94   /* Default limit on number of chunks.  Care should be taken
    90     95   ** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT
    91     96   ** format specifier. It may be changed by calling
    92     97   ** the xFileControl() interface.
    93     98   */
    94         -#define SQLITE_MULTIPLEX_MAX_CHUNKS 32
           99  +#ifndef SQLITE_MULTIPLEX_MAX_CHUNKS
          100  +# define SQLITE_MULTIPLEX_MAX_CHUNKS 32
          101  +#endif
    95    102   
    96    103   /* If SQLITE_MULTIPLEX_EXT_OVWR is defined, the 
    97    104   ** last SQLITE_MULTIPLEX_EXT_SZ characters of the 
    98    105   ** filename will be overwritten, otherwise, the 
    99    106   ** multiplex extension is simply appended to the filename.
   100    107   ** Ex.  (undefined) test.db -> test.db01
   101    108   **      (defined)   test.db -> test.01
................................................................................
   427    434       pGroup = sqlite3_malloc( sz );
   428    435       if( pGroup==0 ){
   429    436         rc=SQLITE_NOMEM;
   430    437       }
   431    438     }
   432    439   
   433    440     if( rc==SQLITE_OK ){
          441  +    const char *zChunkSize;
   434    442       /* assign pointers to extra space allocated */
   435    443       char *p = (char *)&pGroup[1];
   436    444       pMultiplexOpen->pGroup = pGroup;
   437    445       memset(pGroup, 0, sz);
   438    446       pGroup->bEnabled = -1;
   439    447       pGroup->nChunkSize = SQLITE_MULTIPLEX_CHUNK_SIZE;
          448  +    zChunkSize = sqlite3_uri_parameter(zName, "chunksize");
          449  +    if( zChunkSize ){
          450  +      int n = atoi(zChunkSize);
          451  +      if( n>0 ) pGroup->nChunkSize = (n+0xffff)&~0xffff;
          452  +    }
   440    453       pGroup->nMaxChunks = SQLITE_MULTIPLEX_MAX_CHUNKS;
   441    454       pGroup->pReal = (sqlite3_file **)p;
   442    455       p += (sizeof(sqlite3_file *)*pGroup->nMaxChunks);
   443    456       for(i=0; i<pGroup->nMaxChunks; i++){
   444    457         pGroup->pReal[i] = (sqlite3_file *)p;
   445    458         p += pOrigVfs->szOsFile;
   446    459       }