Skip to content

Commit a9884f6

Browse files
committed
Fix broken test / only return a CopyDoneResult if we have one
1 parent 09610ec commit a9884f6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pglogrepl.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,6 @@ type CopyDoneResult struct {
748748
// SendStandbyCopyDone sends a StandbyCopyDone to the PostgreSQL server
749749
// to confirm ending the copy-both mode.
750750
func SendStandbyCopyDone(_ context.Context, conn *pgconn.PgConn) (cdr *CopyDoneResult, err error) {
751-
cdr = &CopyDoneResult{}
752-
753751
// I am suspicious that this is wildly wrong, but I'm pretty sure the previous
754752
// code was wildly wrong too -- wttw <[email protected]>
755753
conn.Frontend().Send(&pgproto3.CopyDone{})
@@ -778,6 +776,7 @@ func SendStandbyCopyDone(_ context.Context, conn *pgconn.PgConn) (cdr *CopyDoneR
778776
if lerr == nil {
779777
lsn, lerr := ParseLSN(string(m.Values[1]))
780778
if lerr == nil {
779+
cdr = &CopyDoneResult{}
781780
cdr.Timeline = int32(timeline)
782781
cdr.LSN = lsn
783782
}

0 commit comments

Comments
 (0)