File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -192,9 +192,14 @@ private function getBinlogStream(): void
192
192
$ this ->executeSQL ('SET @master_binlog_checksum = @@global.binlog_checksum ' );
193
193
}
194
194
195
+
195
196
if ($ this ->config ->heartbeatPeriod > 0.00 ) {
196
197
// master_heartbeat_period is in nanoseconds
197
- $ this ->executeSQL ('SET @master_heartbeat_period = ' . $ this ->config ->heartbeatPeriod * 1000000000 );
198
+ if (version_compare ($ this ->repository ->getVersion (),"8.4.0 " )>=0 ){
199
+ $ this ->executeSQL ('SET @source_heartbeat_period = ' . $ this ->config ->heartbeatPeriod * 1000000000 );
200
+ }else {
201
+ $ this ->executeSQL ('SET @master_heartbeat_period = ' . $ this ->config ->heartbeatPeriod * 1000000000 );
202
+ }
198
203
199
204
$ this ->logger ->info ('Heartbeat period set to ' . $ this ->config ->heartbeatPeriod . ' seconds ' );
200
205
}
Original file line number Diff line number Diff line change @@ -57,21 +57,22 @@ public function isCheckSum(): bool
57
57
58
58
public function getVersion (): string
59
59
{
60
- $ r = '' ;
61
- $ versions = $ this ->getConnection ()
62
- ->fetchAllAssociative ('SHOW VARIABLES LIKE "version%" ' );
63
-
64
- foreach ($ versions as $ version ) {
65
- $ r .= $ version ['Value ' ];
66
- }
60
+ $ res = $ this ->getConnection ()
61
+ ->fetchAssociative ('SHOW VARIABLES LIKE "version" ' );
67
62
68
- return $ r ;
63
+ return $ res [ ' Value ' ]?? "" ;
69
64
}
70
65
71
66
public function getMasterStatus (): MasterStatusDTO
72
67
{
73
- $ data = $ this ->getConnection ()
74
- ->fetchAssociative ('SHOW MASTER STATUS ' );
68
+ var_dump ($ this ->getVersion ());
69
+ if (version_compare ($ this ->getVersion (),"8.4.0 " )>=0 ){
70
+ $ data = $ this ->getConnection ()
71
+ ->fetchAssociative ('SHOW BINARY LOG STATUS ' );
72
+ }else {
73
+ $ data = $ this ->getConnection ()
74
+ ->fetchAssociative ('SHOW MASTER STATUS ' );
75
+ }
75
76
if (empty ($ data )) {
76
77
throw new BinLogException (
77
78
MySQLReplicationException::BINLOG_NOT_ENABLED ,
You can’t perform that action at this time.
0 commit comments