SQLite

Check-in [8b6056f2ee]
Login

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

Overview
Comment:Fix a bug in the new checkpoint computation. Also update the checkpoint algorithm in the test scripts to align with the new implementation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8b6056f2ee596f31b157a792fac05d11f7cb63bb
User & Date: drh 2010-05-19 19:09:38.000
Context
2010-05-19
19:26
Add the SQLITE_FCNTL_SIZE_HINT operator to sqlite3_file_control() and use it to give the VFS hints about the ultimate size of a database file when the file is growing. (check-in: 2b7e3b4a30 user: drh tags: trunk)
19:09
Fix a bug in the new checkpoint computation. Also update the checkpoint algorithm in the test scripts to align with the new implementation. (check-in: 8b6056f2ee user: drh tags: trunk)
18:08
Revise the checksumming algorithm in wal.c. More variable refactoring. (check-in: 542b90eba6 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wal.c.
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
  u32 s2 = aCksum[1];
  u8 *aEnd = (u8*)&a[nByte];

  assert( nByte>=8 );
  assert( (nByte&0x00000003)==0 );

  do {
    s1 += (a[0]<<24) + (a[2]<<16) + (a[2]<<8) + a[3] + s2;
    s2 += (a[3]<<24) + (a[5]<<16) + (a[6]<<8) + a[7] + s1;
    a += 8;
  }while( a<aEnd );
  aCksum[0] = s1;
  aCksum[1] = s2;
}

/*







|
|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
  u32 s2 = aCksum[1];
  u8 *aEnd = (u8*)&a[nByte];

  assert( nByte>=8 );
  assert( (nByte&0x00000003)==0 );

  do {
    s1 += (a[0]<<24) + (a[1]<<16) + (a[2]<<8) + a[3] + s2;
    s2 += (a[4]<<24) + (a[5]<<16) + (a[6]<<8) + a[7] + s1;
    a += 8;
  }while( a<aEnd );
  aCksum[0] = s1;
  aCksum[1] = s2;
}

/*
Changes to test/wal.test.
1281
1282
1283
1284
1285
1286
1287

1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
  set blob
}

proc logcksum {ckv1 ckv2 blob} {
  upvar $ckv1 c1
  upvar $ckv2 c2


  binary scan $blob i* values
  foreach v $values {
    set v [expr {$v & 0xFFFFFFFF}]
    incr c1 $v
    incr c2 $c1
  }

  set c1 [expr ($c1 + ($c1>>24))&0xFFFFFFFF]
  set c2 [expr ($c2 + ($c2>>24))&0xFFFFFFFF]
}

file copy -force test.db testX.db
foreach {tn pgsz works} { 
  1    128    0
  2    256    0
  3    512    1
  4   1024    1
  5   2048    1
  6   4096    1
  7   8192    1
  8  16384    1
  9  32768    1
 10  65536    0
 11   1020    0
} {

  if {$::SQLITE_MAX_PAGE_SIZE < $pgsz} {
    set works 0
  }

  for {set pg 1} {$pg <= 3} {incr pg} {







>
|
|
|
<
|

<
<
<














|







1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291

1292
1293



1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
  set blob
}

proc logcksum {ckv1 ckv2 blob} {
  upvar $ckv1 c1
  upvar $ckv2 c2


  binary scan $blob I* values
  foreach {v1 v2} $values {
    set c1 [expr {($c1 + $v1 + $c2)&0xFFFFFFFF}]

    set c2 [expr {($c2 + $v2 + $c1)&0xFFFFFFFF}]
  }



}

file copy -force test.db testX.db
foreach {tn pgsz works} { 
  1    128    0
  2    256    0
  3    512    1
  4   1024    1
  5   2048    1
  6   4096    1
  7   8192    1
  8  16384    1
  9  32768    1
 10  65536    0
 11   1016    0
} {

  if {$::SQLITE_MAX_PAGE_SIZE < $pgsz} {
    set works 0
  }

  for {set pg 1} {$pg <= 3} {incr pg} {
1475
1476
1477
1478
1479
1480
1481
1482
} {16384}
integrity_check wal-20.5

catch { db2 close }
catch { db close }

finish_test








<
1472
1473
1474
1475
1476
1477
1478

} {16384}
integrity_check wal-20.5

catch { db2 close }
catch { db close }

finish_test