1
1
mirror of https://github.com/wader/fq.git synced 2024-12-29 00:22:38 +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 package postgres
import ( import (
"fmt"
"github.com/wader/fq/format/postgres/common" "github.com/wader/fq/format/postgres/common"
"github.com/wader/fq/pkg/decode" "github.com/wader/fq/pkg/decode"
) )
@ -279,12 +281,12 @@ func decodeXLogRecord(wal *Wal, maxBytes int64) {
pos0 := record.Pos() pos0 := record.Pos()
maxLen := maxBytes * 8 maxLen := maxBytes * 8
if record.FieldGet("xlog_body0") == nil { for i := 0; ; i++ {
// body on first page fieldName := fmt.Sprintf("xlog_body%d", i)
record.FieldRawLen("xlog_body0", maxLen) if record.FieldGet(fieldName) == nil {
} else { record.FieldRawLen(fieldName, maxLen)
// body on second page break
record.FieldRawLen("xlog_body1", maxLen) }
} }
pos1 := record.Pos() pos1 := record.Pos()
posMax := pos1 posMax := pos1