jackc / pglogrepl

PostgreSQL logical replication library for Go.
MIT License
336 stars 63 forks source link

SendStandbyCopyDone panics at timeline change #51

Closed orgrim closed 1 year ago

orgrim commented 1 year ago

When there is a timeline change, the server sends a CopyDone, when SendStandbyCopyDone after receiving this message, the server sends a single DataRow message with the new timeline ID and the LSN of the timeline switch.

The parsing of the DataRow in SendStandbyCopyDone fails with a panic when the new timeline id is less than 10:

panic: runtime error: index out of range [1] with length 1

goroutine 6 [running]:
github.com/jackc/pglogrepl.SendStandbyCopyDone({0x600d86e30?, 0x600d86e30?}, 0xc0000e0800)
    /home/orgrim/dev/pgbb/vendor/github.com/jackc/pglogrepl/pglogrepl.go:701 +0x4a5