/ Check-in [c7445812]
Login

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

Overview
Comment:A couple simple fixes to get wal.test mostly working.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal-refactor
Files: files | file ages | folders
SHA1: c74458127468f30b16715594c8d68e9d3c05d292
User & Date: drh 2010-05-12 18:10:52
Context
2010-05-12
18:30
Fix for the test_devsym.c test module for the VFS-SHM refactoring. check-in: 49d62933 user: drh tags: wal-refactor
18:10
A couple simple fixes to get wal.test mostly working. check-in: c7445812 user: drh tags: wal-refactor
18:01
Refactoring the VFS-SHM methods used by WAL. This version compiles and runs non-WAL test cases but crashes and burns on wal.test. check-in: 2b00152c user: drh tags: wal-refactor
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wal.c.

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
*/
static int walSetLock(Wal *pWal, int desiredStatus){
  int rc = SQLITE_OK;             /* Return code */
  if( pWal->exclusiveMode || pWal->lockState==desiredStatus ){
    pWal->lockState = desiredStatus;
  }else{
    int got = pWal->lockState;
    rc = sqlite3OsShmLock(pWal->pWalFd, desiredStatus, &got);
    pWal->lockState = got;
    if( got==SQLITE_SHM_READ_FULL || got==SQLITE_SHM_READ ){
      pWal->readerType = got;
      pWal->lockState = SQLITE_SHM_READ;
    }
  }
  return rc;
................................................................................
  int nWal;                       /* Length of zWal in bytes */

  assert( zDbName && zDbName[0] );
  assert( pDbFd );

  /* Allocate an instance of struct Wal to return. */
  *ppWal = 0;
  nWal = sqlite3Strlen30(zWal) + 5;
  pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile + nWal);
  if( !pRet ){
    return SQLITE_NOMEM;
  }

  pRet->pVfs = pVfs;
  pRet->pWalFd = (sqlite3_file *)&pRet[1];







|







 







|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
*/
static int walSetLock(Wal *pWal, int desiredStatus){
  int rc = SQLITE_OK;             /* Return code */
  if( pWal->exclusiveMode || pWal->lockState==desiredStatus ){
    pWal->lockState = desiredStatus;
  }else{
    int got = pWal->lockState;
    rc = sqlite3OsShmLock(pWal->pDbFd, desiredStatus, &got);
    pWal->lockState = got;
    if( got==SQLITE_SHM_READ_FULL || got==SQLITE_SHM_READ ){
      pWal->readerType = got;
      pWal->lockState = SQLITE_SHM_READ;
    }
  }
  return rc;
................................................................................
  int nWal;                       /* Length of zWal in bytes */

  assert( zDbName && zDbName[0] );
  assert( pDbFd );

  /* Allocate an instance of struct Wal to return. */
  *ppWal = 0;
  nWal = sqlite3Strlen30(zDbName) + 5;
  pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile + nWal);
  if( !pRet ){
    return SQLITE_NOMEM;
  }

  pRet->pVfs = pVfs;
  pRet->pWalFd = (sqlite3_file *)&pRet[1];