Skip to content

Commit 65e8dca

Browse files
committed
Add a testcase with a binlog postion of >1 byte
1 parent 29b955a commit 65e8dca

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

cmd/go-mysqlbinlog/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010
"log/slog"
1111
"os"
12+
"time"
1213

1314
"github.com/pingcap/errors"
1415

@@ -51,6 +52,8 @@ func main() {
5152
SemiSyncEnabled: *semiSync,
5253
UseDecimal: true,
5354
MaxReconnectAttempts: 10,
55+
HeartbeatPeriod: time.Second * 10,
56+
DumpCommandFlag: replication.USE_HEARTBEAT_EVENT_V2,
5457
}
5558

5659
logOpts := &slog.HandlerOptions{

replication/event_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ func TestHeartbeatEvent(t *testing.T) {
234234
[]byte{},
235235
HeartbeatEvent{},
236236
},
237+
{
238+
false,
239+
2,
240+
[]byte{0x1, 0xd, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x2e, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x2, 0x4, 0xfd, 0xbb, 0xaf, 0x27, 0x0},
241+
HeartbeatEvent{Version: 2, Filename: "binlog.000001", Offset: 2600891},
242+
},
237243
}
238244

239245
for _, tc := range testcases {

0 commit comments

Comments
 (0)