/ Check-in [a00d2ed4]
Login

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

Overview
Comment:Drop the mutex on the multiplexor before entering the xRead VFS call.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | multiplex-parallel-read
Files: files | file ages | folders
SHA1: a00d2ed49c9f53263cd76ad41dad9e35e646ebb5
User & Date: drh 2013-10-21 13:15:55
Context
2013-11-08
12:14
Merge change to drop the mutex on the multiplexor before entering the xRead VFS call, in order to enhance parallelizability. check-in: 3c566e41 user: drh tags: trunk
2013-10-21
13:15
Drop the mutex on the multiplexor before entering the xRead VFS call. Closed-Leaf check-in: a00d2ed4 user: drh tags: multiplex-parallel-read
2013-10-19
16:51
Improved header comment with better instructions on the vfslog.c extension. check-in: 4bd592c8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_multiplex.c.

   751    751     void *pBuf,
   752    752     int iAmt,
   753    753     sqlite3_int64 iOfst
   754    754   ){
   755    755     multiplexConn *p = (multiplexConn*)pConn;
   756    756     multiplexGroup *pGroup = p->pGroup;
   757    757     int rc = SQLITE_OK;
   758         -  multiplexEnter();
          758  +  int nMutex = 0;
          759  +  multiplexEnter(); nMutex++;
   759    760     if( !pGroup->bEnabled ){
   760    761       sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL, 0);
          762  +    multiplexLeave(); nMutex--;
   761    763       if( pSubOpen==0 ){
   762    764         rc = SQLITE_IOERR_READ;
   763    765       }else{
   764    766         rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst);
   765    767       }
   766    768     }else{
   767    769       while( iAmt > 0 ){
   768    770         int i = (int)(iOfst / pGroup->szChunk);
          771  +      if( nMutex==0 ){ multiplexEnter(); nMutex++; }
   769    772         sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL, 1);
          773  +      multiplexLeave(); nMutex--;
   770    774         if( pSubOpen ){
   771    775           int extra = ((int)(iOfst % pGroup->szChunk) + iAmt) - pGroup->szChunk;
   772    776           if( extra<0 ) extra = 0;
   773    777           iAmt -= extra;
   774    778           rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt,
   775    779                                          iOfst % pGroup->szChunk);
   776    780           if( rc!=SQLITE_OK ) break;
................................................................................
   779    783           iAmt = extra;
   780    784         }else{
   781    785           rc = SQLITE_IOERR_READ;
   782    786           break;
   783    787         }
   784    788       }
   785    789     }
   786         -  multiplexLeave();
          790  +  assert( nMutex==0 || nMutex==1 );
          791  +  if( nMutex ) multiplexLeave();
   787    792     return rc;
   788    793   }
   789    794   
   790    795   /* Pass xWrite requests thru to the original VFS after
   791    796   ** determining the correct chunk to operate on.
   792    797   ** Break up writes across chunk boundaries.
   793    798   */