1
1
mirror of https://github.com/wader/fq.git synced 2024-12-28 08:02:28 +03:00

postgres: wal support multiple xlog_body for wal record

This commit is contained in:
Pavel Safonov 2022-11-10 11:32:25 +03:00
parent e8bb1692f6
commit 015b770585

View File

@ -1,6 +1,8 @@
package postgres
import (
"fmt"
"github.com/wader/fq/format/postgres/common"
"github.com/wader/fq/pkg/decode"
)
@ -279,12 +281,12 @@ func decodeXLogRecord(wal *Wal, maxBytes int64) {
pos0 := record.Pos()
maxLen := maxBytes * 8
if record.FieldGet("xlog_body0") == nil {
// body on first page
record.FieldRawLen("xlog_body0", maxLen)
} else {
// body on second page
record.FieldRawLen("xlog_body1", maxLen)
for i := 0; ; i++ {
fieldName := fmt.Sprintf("xlog_body%d", i)
if record.FieldGet(fieldName) == nil {
record.FieldRawLen(fieldName, maxLen)
break
}
}
pos1 := record.Pos()
posMax := pos1