/ Check-in [7f00d80c]
Login

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

Overview
Comment:Move the write failure test in memjrnlCreateFile() to just after the actual write, thus reducing the number of instances of the test by one.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7f00d80c63b15376391f661d872f2b29a970702d
User & Date: drh 2016-03-09 03:44:32
Context
2016-03-09
04:17
Simplifications to the memjournal.c logic to facilitate testing. check-in: 8baa2c2c user: drh tags: trunk
03:44
Move the write failure test in memjrnlCreateFile() to just after the actual write, thus reducing the number of instances of the test by one. check-in: 7f00d80c user: drh tags: trunk
03:29
Update a comment in btree.c to account for WITHOUT ROWID tables. No code changes. check-in: fa20dcb0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/memjournal.c.

141
142
143
144
145
146
147
148
149
150
151
152
153
154

155
156
157
158
159
160
161

  memset(p, 0, sizeof(MemJournal));
  rc = sqlite3OsOpen(copy.pVfs, copy.zJournal, pReal, copy.flags, 0);
  if( rc==SQLITE_OK ){
    int nChunk = copy.nChunkSize;
    i64 iOff = 0;
    FileChunk *pIter;
    for(pIter=copy.pFirst; pIter && rc==SQLITE_OK; pIter=pIter->pNext){
      int nWrite = nChunk;
      if( pIter==copy.endpoint.pChunk ){
        nWrite = copy.endpoint.iOffset % copy.nChunkSize;
        if( nWrite==0 ) nWrite = copy.nChunkSize;
      }
      rc = sqlite3OsWrite(pReal, (u8*)pIter->zChunk, nWrite, iOff);

      iOff += nWrite;
    }
    if( rc==SQLITE_OK ){
      /* No error has occurred. Free the in-memory buffers. */
      memjrnlFreeChunks(&copy);
    }
  }







|






>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

  memset(p, 0, sizeof(MemJournal));
  rc = sqlite3OsOpen(copy.pVfs, copy.zJournal, pReal, copy.flags, 0);
  if( rc==SQLITE_OK ){
    int nChunk = copy.nChunkSize;
    i64 iOff = 0;
    FileChunk *pIter;
    for(pIter=copy.pFirst; pIter; pIter=pIter->pNext){
      int nWrite = nChunk;
      if( pIter==copy.endpoint.pChunk ){
        nWrite = copy.endpoint.iOffset % copy.nChunkSize;
        if( nWrite==0 ) nWrite = copy.nChunkSize;
      }
      rc = sqlite3OsWrite(pReal, (u8*)pIter->zChunk, nWrite, iOff);
      if( rc ) break;
      iOff += nWrite;
    }
    if( rc==SQLITE_OK ){
      /* No error has occurred. Free the in-memory buffers. */
      memjrnlFreeChunks(&copy);
    }
  }