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:
parent
e8bb1692f6
commit
015b770585
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user