/ Check-in [2d50f781]
Login

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

Overview
Comment:Fix some problems with dropped error codes in multiplexOpen().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nx-devkit
Files: files | file ages | folders
SHA1:2d50f78188e3297e8cefdf73cff51fa0a3b36e65
User & Date: dan 2011-12-15 11:45:19
Context
2011-12-15
13:29
Make sure the chunksize in test_multiplex does not cause the pending byte to fall near the end of a chunk. Adjust the chunksize upward as necessary to prevent this. check-in: e05f8a29 user: drh tags: nx-devkit
11:45
Fix some problems with dropped error codes in multiplexOpen(). check-in: 2d50f781 user: dan tags: nx-devkit
02:22
In the multiplexor, do not try to delete overflow files that do not exist. And assume all but the last overflow file is the size of the chunk size. check-in: a822a80d user: drh tags: nx-devkit
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_multiplex.c.

   462    462         memcpy(pGroup->zName, zName, nName+1);
   463    463         pGroup->nName = nName;
   464    464       }
   465    465       pGroup->flags = flags;
   466    466       rc = multiplexSubFilename(pGroup, 1);
   467    467       if( rc==SQLITE_OK ){
   468    468         pSubOpen = multiplexSubOpen(pGroup, 0, &rc, pOutFlags);
          469  +      assert( pSubOpen || rc!=SQLITE_OK );
   469    470       }
   470         -    if( pSubOpen ){
   471         -      int exists, rc2, rc3;
          471  +    if( rc==SQLITE_OK ){
   472    472         sqlite3_int64 sz;
   473    473   
   474         -      rc2 = pSubOpen->pMethods->xFileSize(pSubOpen, &sz);
   475         -      if( rc2==SQLITE_OK && zName ){
          474  +      rc = pSubOpen->pMethods->xFileSize(pSubOpen, &sz);
          475  +      if( rc==SQLITE_OK && zName ){
          476  +        int exists;
          477  +
   476    478           /* If the first overflow file exists and if the size of the main file
   477    479           ** is different from the chunk size, that means the chunk size is set
   478    480           ** set incorrectly.  So fix it.
   479    481           **
   480    482           ** Or, if the first overflow file does not exist and the main file is
   481    483           ** larger than the chunk size, that means the chunk size is too small.
   482    484           ** But we have no way of determining the intended chunk size, so 
   483    485           ** just disable the multiplexor all togethre.
   484    486           */
   485         -        rc3 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z,
          487  +        rc = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z,
   486    488               SQLITE_ACCESS_EXISTS, &exists);
   487         -        if( rc3==SQLITE_OK && exists && sz==(sz&0xffff0000) && sz>0
          489  +        if( rc==SQLITE_OK && exists && sz==(sz&0xffff0000) && sz>0
   488    490               && sz!=pGroup->szChunk ){
   489    491             pGroup->szChunk = sz;
   490         -        }else if( rc3==SQLITE_OK && !exists && sz>pGroup->szChunk ){
          492  +        }else if( rc==SQLITE_OK && !exists && sz>pGroup->szChunk ){
   491    493             pGroup->bEnabled = 0;
   492    494           }
   493    495         }
          496  +    }
   494    497   
          498  +    if( rc==SQLITE_OK ){
   495    499         if( pSubOpen->pMethods->iVersion==1 ){
   496    500           pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV1;
   497    501         }else{
   498    502           pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV2;
   499    503         }
   500    504         /* place this group at the head of our list */
   501    505         pGroup->pNext = gMultiplex.pGroups;