SQLite

Changes On Branch 3-digit-multiplex-suffix
Login

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

Changes In Branch 3-digit-multiplex-suffix Excluding Merge-Ins

This is equivalent to a diff from a5418c7f to 06e0cdaf

2011-11-18
13:10
Change the multiplexor to use a 3-digit suffix. (check-in: 0b7edc44 user: drh tags: trunk)
2011-11-16
18:08
Merge the PCACHE2 changes into trunk. (check-in: 457513f2 user: drh tags: trunk)
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)
15:41
Fix an invalid assert() statement added by [3b58f5f066]. (check-in: 888b09dd user: dan tags: trunk)

Changes to src/test_multiplex.c.

92
93
94
95
96
97
98
99

100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
92
93
94
95
96
97
98

99


100
101
102
103
104
105
106











107
108
109
110
111
112
113







-
+
-
-
+






-
-
-
-
-
-
-
-
-
-
-







** the xFileControl() interface.  It will be rounded up to a 
** multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
*/
#ifndef SQLITE_MULTIPLEX_CHUNK_SIZE
# define SQLITE_MULTIPLEX_CHUNK_SIZE 2147418112
#endif

/* Default limit on number of chunks.  Care should be taken
/* Default limit on number of chunks.
** so that values for chunks numbers fit in the SQLITE_MULTIPLEX_EXT_FMT
** format specifier. It may be changed by calling
** May be changed by calling
** the xFileControl() interface.
*/
#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 
** filename will be overwritten, otherwise, the 
** multiplex extension is simply appended to the filename.
** Ex.  (undefined) test.db -> test.db01
**      (defined)   test.db -> test.01
** Chunk 0 does not have a modified extension.
*/
#define SQLITE_MULTIPLEX_EXT_FMT    "%02d"
#define SQLITE_MULTIPLEX_EXT_SZ     2

/************************ Object Definitions ******************************/

/* Forward declaration of all object types */
typedef struct multiplexGroup multiplexGroup;
typedef struct multiplexConn multiplexConn;

/*
300
301
302
303
304
305
306
307

308
309
310
311
312
313
314
315
316
317



318
319
320

321
322
323
324
325
326
327
288
289
290
291
292
293
294

295
296
297
298
299
300
301




302
303
304

305

306
307
308
309
310
311
312
313







-
+






-
-
-
-
+
+
+
-

-
+







    memset(&p[pGroup->nReal], 0, sizeof(p[0])*(iChunk+1-pGroup->nReal));
    pGroup->aReal = p;
    pGroup->nReal = iChunk+1;
  }
  if( pGroup->aReal[iChunk].z==0 ){
    char *z;
    int n = pGroup->nName;
    pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+3 );
    pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+4 );
    if( z==0 ){
      return SQLITE_NOMEM;
    }
    memcpy(z, pGroup->zName, n+1);
    if( iChunk>0 ){
#ifdef SQLITE_ENABLE_8_3_NAMES
      if( n>3 && z[n-3]=='.' ){
        n--;
      }else if( n>4 && z[n-4]=='.' ){
        n -= 2;
      int i;
      for(i=n-1; i>0 && i>=n-4 && z[i]!='.'; i--){}
      if( i>=n-4 ) n = i+1;
      }
#endif
      sqlite3_snprintf(3,&z[n],"%02d",iChunk);
      sqlite3_snprintf(4,&z[n],"%03d",iChunk);
    }
  }
  return SQLITE_OK;
}

/* Translate an sqlite3_file* that is really a multiplexGroup* into
** the sqlite3_file* for the underlying original VFS.

Changes to test/multiplex.test.

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34







-
+







# This handles appending the chunk number
# to the end of the filename.  if 
# SQLITE_MULTIPLEX_EXT_OVWR is defined, then
# it overwrites the last 2 bytes of the 
# file name with the chunk number.
proc multiplex_name {name chunk} {
  if {$chunk==0} { return $name }
  set num [format "%02d" $chunk]
  set num [format "%03d" $chunk]
  ifcapable {multiplex_ext_overwrite} {
    set name [string range $name 0 [expr [string length $name]-2-1]]
  }
  return $name$num
}

# This saves off the parameters and calls the