wp
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user