This commit is contained in:
2026-06-15 01:20:30 +03:00
parent b32279deaf
commit 80309aab99
20 changed files with 149 additions and 40 deletions

View File

@@ -53,6 +53,7 @@ func (s *WALReader) NextPacket() (_ []any, _ bool, err error) {
} else {
current, err = s.readPacket()
if err != nil {
err = fmt.Errorf("readPacket: %s", err)
return
}
if current == nil {
@@ -61,6 +62,7 @@ func (s *WALReader) NextPacket() (_ []any, _ bool, err error) {
}
s.next, err = s.readPacket()
if err != nil {
err = fmt.Errorf("readPacket: %s", err)
return
}
return current, s.next == nil, nil
@@ -85,9 +87,12 @@ func (s *WALReader) readPacket() (_ []any, err error) {
}
calculatedCRC := util.CalculateCRC32(body)
if calculatedCRC != writtenCRC {
//fmt.Printf("bodySize: %d\n", bodySize)
//fmt.Printf("body: % x\n", body)
return nil, fmt.Errorf("written CRC %d != calculated CRC %d",
writtenCRC, calculatedCRC)
}
//fmt.Println("SAME CRC")
return s.parseRecords(body)
}