mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Change the WAL file format to support two kinds of checksums - one that is fast to calculate on little-endian architectures and another that is fast on big-endian architectures. A flag in the wal-header indicates which the file uses.
FossilOrigin-Name: 65ba804dd1d31d1eef6ae3f40a3ade344a410b84
This commit is contained in:
@ -1288,8 +1288,12 @@ proc logcksum {ckv1 ckv2 blob} {
|
||||
upvar $ckv1 c1
|
||||
upvar $ckv2 c2
|
||||
|
||||
set scanpattern I*
|
||||
if {$::tcl_platform(byteOrder) eq "littleEndian"} {
|
||||
set scanpattern i*
|
||||
}
|
||||
|
||||
binary scan $blob I* values
|
||||
binary scan $blob $scanpattern values
|
||||
foreach {v1 v2} $values {
|
||||
set c1 [expr {($c1 + $v1 + $c2)&0xFFFFFFFF}]
|
||||
set c2 [expr {($c2 + $v2 + $c1)&0xFFFFFFFF}]
|
||||
@ -1347,6 +1351,7 @@ foreach {tn pgsz works} {
|
||||
logcksum c1 c2 $framehdr
|
||||
logcksum c1 c2 $framebody
|
||||
set framehdr [binary format IIIIII $pg 5 22 23 $c1 $c2]
|
||||
|
||||
set fd [open test.db-wal w]
|
||||
fconfigure $fd -encoding binary -translation binary
|
||||
puts -nonewline $fd $walhdr
|
||||
|
Reference in New Issue
Block a user