/ Check-in [06e0cdaf]
Login

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

Overview
Comment:Change the multiplexor suffix from 2 to 3 digits.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 3-digit-multiplex-suffix
Files: files | file ages | folders
SHA1: 06e0cdaf9112f722c23692e25c5b1f99b61c2d78
User & Date: drh 2011-11-16 17:32:28
Context
2011-11-18
13:10
Change the multiplexor to use a 3-digit suffix. check-in: 0b7edc44 user: drh tags: trunk
2011-11-16
17:32
Change the multiplexor suffix from 2 to 3 digits. Closed-Leaf check-in: 06e0cdaf user: drh tags: 3-digit-multiplex-suffix
16:23
Remove code made obsolete by the changes to index processing that allow range search on the rowid. check-in: a5418c7f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_multiplex.c.

    92     92   ** the xFileControl() interface.  It will be rounded up to a 
    93     93   ** multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
    94     94   */
    95     95   #ifndef SQLITE_MULTIPLEX_CHUNK_SIZE
    96     96   # define SQLITE_MULTIPLEX_CHUNK_SIZE 2147418112
    97     97   #endif
    98     98   
    99         -/* Default limit on number of chunks.  Care should be taken
   100         -** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT
   101         -** format specifier. It may be changed by calling
           99  +/* Default limit on number of chunks.
          100  +** May be changed by calling
   102    101   ** the xFileControl() interface.
   103    102   */
   104    103   #ifndef SQLITE_MULTIPLEX_MAX_CHUNKS
   105    104   # define SQLITE_MULTIPLEX_MAX_CHUNKS 32
   106    105   #endif
   107    106   
   108         -/* If SQLITE_MULTIPLEX_EXT_OVWR is defined, the 
   109         -** last SQLITE_MULTIPLEX_EXT_SZ characters of the 
   110         -** filename will be overwritten, otherwise, the 
   111         -** multiplex extension is simply appended to the filename.
   112         -** Ex.  (undefined) test.db -> test.db01
   113         -**      (defined)   test.db -> test.01
   114         -** Chunk 0 does not have a modified extension.
   115         -*/
   116         -#define SQLITE_MULTIPLEX_EXT_FMT    "%02d"
   117         -#define SQLITE_MULTIPLEX_EXT_SZ     2
   118         -
   119    107   /************************ Object Definitions ******************************/
   120    108   
   121    109   /* Forward declaration of all object types */
   122    110   typedef struct multiplexGroup multiplexGroup;
   123    111   typedef struct multiplexConn multiplexConn;
   124    112   
   125    113   /*
................................................................................
   300    288       memset(&p[pGroup->nReal], 0, sizeof(p[0])*(iChunk+1-pGroup->nReal));
   301    289       pGroup->aReal = p;
   302    290       pGroup->nReal = iChunk+1;
   303    291     }
   304    292     if( pGroup->aReal[iChunk].z==0 ){
   305    293       char *z;
   306    294       int n = pGroup->nName;
   307         -    pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+3 );
          295  +    pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+4 );
   308    296       if( z==0 ){
   309    297         return SQLITE_NOMEM;
   310    298       }
   311    299       memcpy(z, pGroup->zName, n+1);
   312    300       if( iChunk>0 ){
   313    301   #ifdef SQLITE_ENABLE_8_3_NAMES
   314         -      if( n>3 && z[n-3]=='.' ){
   315         -        n--;
   316         -      }else if( n>4 && z[n-4]=='.' ){
   317         -        n -= 2;
   318         -      }
          302  +      int i;
          303  +      for(i=n-1; i>0 && i>=n-4 && z[i]!='.'; i--){}
          304  +      if( i>=n-4 ) n = i+1;
   319    305   #endif
   320         -      sqlite3_snprintf(3,&z[n],"%02d",iChunk);
          306  +      sqlite3_snprintf(4,&z[n],"%03d",iChunk);
   321    307       }
   322    308     }
   323    309     return SQLITE_OK;
   324    310   }
   325    311   
   326    312   /* Translate an sqlite3_file* that is really a multiplexGroup* into
   327    313   ** the sqlite3_file* for the underlying original VFS.

Changes to test/multiplex.test.

    20     20   # This handles appending the chunk number
    21     21   # to the end of the filename.  if 
    22     22   # SQLITE_MULTIPLEX_EXT_OVWR is defined, then
    23     23   # it overwrites the last 2 bytes of the 
    24     24   # file name with the chunk number.
    25     25   proc multiplex_name {name chunk} {
    26     26     if {$chunk==0} { return $name }
    27         -  set num [format "%02d" $chunk]
           27  +  set num [format "%03d" $chunk]
    28     28     ifcapable {multiplex_ext_overwrite} {
    29     29       set name [string range $name 0 [expr [string length $name]-2-1]]
    30     30     }
    31     31     return $name$num
    32     32   }
    33     33   
    34     34   # This saves off the parameters and calls the