SQLite

Check-in [72b95fde15]
Login

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

Overview
Comment:Add a missing walIndexUnmap() to sqlite3WalSnapshotOpen().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | wal
Files: files | file ages | folders
SHA1: 72b95fde15dae56390dc8d4168fb2757447e289e
User & Date: dan 2010-04-30 09:32:06.000
Context
2010-04-30
09:52
Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty() with sqlite3WalUndo(). (check-in: a8f958be80 user: dan tags: wal)
09:32
Add a missing walIndexUnmap() to sqlite3WalSnapshotOpen(). (check-in: 72b95fde15 user: dan tags: wal)
06:02
Merge latest bugfix into wal branch. (check-in: 265e66e698 user: dan tags: wal)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
/*
** Query and/or changes the size of a shared-memory segment.
** The reqSize parameter is the new size of the segment, or -1 to
** do just a query.  The size of the segment after resizing is
** written into pNewSize.  A writer lock is held on the shared memory
** segment while resizing it.
**
** If ppBuffer is not NULL, the a reader lock is acquired no the shared
** memory segment and *ppBuffer is made to point to the start of the 
** shared memory segment.  xShmRelease() must be called to release the
** lock.
*/
static int unixShmSize(
  sqlite3_shm *pSharedMem,  /* Pointer returned by unixShmOpen() */
  int reqSize,              /* Requested size.  -1 for query only */







|







5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
/*
** Query and/or changes the size of a shared-memory segment.
** The reqSize parameter is the new size of the segment, or -1 to
** do just a query.  The size of the segment after resizing is
** written into pNewSize.  A writer lock is held on the shared memory
** segment while resizing it.
**
** If ppBuffer is not NULL, the a reader lock is acquired on the shared
** memory segment and *ppBuffer is made to point to the start of the 
** shared memory segment.  xShmRelease() must be called to release the
** lock.
*/
static int unixShmSize(
  sqlite3_shm *pSharedMem,  /* Pointer returned by unixShmOpen() */
  int reqSize,              /* Requested size.  -1 for query only */
Changes to src/wal.c.
885
886
887
888
889
890
891


892
893
894
895
896
897
898
      && walIndexEntry(pWal->hdr.iLastPg)>=pWal->szWIndex
     ){
        rc = walIndexRemap(pWal, 0);
        assert( rc || walIndexEntry(pWal->hdr.iLastPg)<pWal->szWIndex );
      }
    }
  }


  return rc;
}

/*
** Unlock the current snapshot.
*/
void sqlite3WalCloseSnapshot(Wal *pWal){







>
>







885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
      && walIndexEntry(pWal->hdr.iLastPg)>=pWal->szWIndex
     ){
        rc = walIndexRemap(pWal, 0);
        assert( rc || walIndexEntry(pWal->hdr.iLastPg)<pWal->szWIndex );
      }
    }
  }

  walIndexUnmap(pWal);
  return rc;
}

/*
** Unlock the current snapshot.
*/
void sqlite3WalCloseSnapshot(Wal *pWal){
1078
1079
1080
1081
1082
1083
1084

1085
1086
1087
1088
1089
1090
1091
  u32 aCksum[2];                  /* Checksums */
  PgHdr *pLast;                   /* Last frame in list */
  int nLast = 0;                  /* Number of extra copies of last page */

  assert( WAL_FRAME_HDRSIZE==(4 * 2 + 2*sizeof(u32)) );
  assert( pList );
  assert( pWal->lockState==SQLITE_SHM_WRITE );


  /* If this is the first frame written into the log, write the log 
  ** header to the start of the log file. See comments at the top of
  ** this file for a description of the log-header format.
  */
  assert( WAL_FRAME_HDRSIZE>=WAL_HDRSIZE );
  iFrame = pWal->hdr.iLastPg;







>







1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
  u32 aCksum[2];                  /* Checksums */
  PgHdr *pLast;                   /* Last frame in list */
  int nLast = 0;                  /* Number of extra copies of last page */

  assert( WAL_FRAME_HDRSIZE==(4 * 2 + 2*sizeof(u32)) );
  assert( pList );
  assert( pWal->lockState==SQLITE_SHM_WRITE );
  assert( pWal->pWiData==0 );

  /* If this is the first frame written into the log, write the log 
  ** header to the start of the log file. See comments at the top of
  ** this file for a description of the log-header format.
  */
  assert( WAL_FRAME_HDRSIZE>=WAL_HDRSIZE );
  iFrame = pWal->hdr.iLastPg;
1154
1155
1156
1157
1158
1159
1160

1161
1162
1163
1164
1165
1166
1167
    }

    rc = sqlite3OsSync(pWal->pFd, sync_flags);
    if( rc!=SQLITE_OK ){
      return rc;
    }
  }


  /* Append data to the log summary. It is not necessary to lock the 
  ** wal-index to do this as the RESERVED lock held on the db file
  ** guarantees that there are no other writers, and no data that may
  ** be in use by existing readers is being overwritten.
  */
  iFrame = pWal->hdr.iLastPg;







>







1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
    }

    rc = sqlite3OsSync(pWal->pFd, sync_flags);
    if( rc!=SQLITE_OK ){
      return rc;
    }
  }
  assert( pWal->pWiData==0 );

  /* Append data to the log summary. It is not necessary to lock the 
  ** wal-index to do this as the RESERVED lock held on the db file
  ** guarantees that there are no other writers, and no data that may
  ** be in use by existing readers is being overwritten.
  */
  iFrame = pWal->hdr.iLastPg;