SQLite4
Check-in [f8ce90c4a6]
Not logged in

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

Overview
Comment:Fix a problem causing builds without LSM_NO_SYNC to fail.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f8ce90c4a67ce436fc63c1dc952185b0edcd33fd
User & Date: dan 2013-10-28 10:56:53
Context
2013-10-28
19:48
Add code for taking and querying read-locks. Untested. check-in: ef0cf1ade3 user: dan tags: trunk
10:56
Fix a problem causing builds without LSM_NO_SYNC to fail. check-in: f8ce90c4a6 user: dan tags: trunk
10:47
Fix some problems with circular logs. check-in: 4b36a0245f user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/bt_log.c.

243
244
245
246
247
248
249

250
251
252
253
254
255
256
257
258
259
260

261
262
263
264
265
266
267
  fprintf(stderr, "%d: Log page %d to frame %d (cksum=%08x%08x)\n", nCall++,
      (int)pgno, (int)iFrame, aCksum[0], aCksum[1]
  );
  fflush(stderr);
#endif
}


void sqlite4BtDebugReadPage(u32 pgno, u8 *aData, int pgsz){
#if 0
  static nCall = 0;
  u32 aCksum[2];
  btLogChecksum(1, aData, pgsz, 0, aCksum);
  fprintf(stderr, "%d: Read page %d (cksum=%08x%08x)\n", nCall++,
      (int)pgno, aCksum[0], aCksum[1]
  );
  fflush(stderr);
#endif
}


/*
** Ensure that shared-memory chunk iChunk is mapped and available in
** the BtLog.apShm[] array. If an error occurs, return an SQLite4 error
** code. Otherwise, SQLITE4_OK.
*/
static int btLogMapShm(BtLog *pLog, int iChunk){







>











>







243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
  fprintf(stderr, "%d: Log page %d to frame %d (cksum=%08x%08x)\n", nCall++,
      (int)pgno, (int)iFrame, aCksum[0], aCksum[1]
  );
  fflush(stderr);
#endif
}

#ifndef NDEBUG
void sqlite4BtDebugReadPage(u32 pgno, u8 *aData, int pgsz){
#if 0
  static nCall = 0;
  u32 aCksum[2];
  btLogChecksum(1, aData, pgsz, 0, aCksum);
  fprintf(stderr, "%d: Read page %d (cksum=%08x%08x)\n", nCall++,
      (int)pgno, aCksum[0], aCksum[1]
  );
  fflush(stderr);
#endif
}
#endif

/*
** Ensure that shared-memory chunk iChunk is mapped and available in
** the BtLog.apShm[] array. If an error occurs, return an SQLite4 error
** code. Otherwise, SQLITE4_OK.
*/
static int btLogMapShm(BtLog *pLog, int iChunk){

Changes to src/bt_unix.c.

176
177
178
179
180
181
182
183
184
185
186
187

188
189
190

191
192
193
194
195
196
197
198
  }

  return rc;
}

static int btPosixOsSync(bt_file *pFile){
  int rc = SQLITE4_OK;

#ifndef LSM_NO_SYNC
  PosixFile *p = (PosixFile *)pFile;
  int prc = 0;


  if( p->pMap ){
    prc = msync(p->pMap, p->nMap, MS_SYNC);
  }

  if( prc==0 ) prc = fdatasync(p->fd);
  if( prc<0 ) rc = btErrorBkpt(SQLITE4_IOERR);
#else
  (void)pFile;
#endif

  return rc;
}







<




>



>
|







176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
  }

  return rc;
}

static int btPosixOsSync(bt_file *pFile){
  int rc = SQLITE4_OK;

#ifndef LSM_NO_SYNC
  PosixFile *p = (PosixFile *)pFile;
  int prc = 0;

#if 0
  if( p->pMap ){
    prc = msync(p->pMap, p->nMap, MS_SYNC);
  }
#endif
  prc = fdatasync(p->fd);
  if( prc<0 ) rc = btErrorBkpt(SQLITE4_IOERR);
#else
  (void)pFile;
#endif

  return rc;
}