Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql8.0X not support "SHOW BINARY LOG STATUS" #2123

Closed
I-Like-Pepsi opened this issue Oct 28, 2024 · 6 comments
Closed

mysql8.0X not support "SHOW BINARY LOG STATUS" #2123

I-Like-Pepsi opened this issue Oct 28, 2024 · 6 comments

Comments

@I-Like-Pepsi
Copy link

image
错误信息如下:
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LOG STATUS' at line
1

I encountered a minor issue while using Maxwell.
mysql-version:8.0.40
I found the following code after reviewing the source code

	public String getShowBinlogSQL() {
		try {
			DatabaseMetaData md = connection.getMetaData();
			if ( md.getDatabaseMajorVersion() >= 8 ) {
				return "SHOW BINARY LOG STATUS";
			}
		} catch ( SQLException e ) {
		}

		return "SHOW MASTER STATUS";
	}

I think the code should be changed to the following

	public String getShowBinlogSQL() {
		try {
			DatabaseMetaData md = connection.getMetaData();
			if ( md.getDatabaseMajorVersion() >= 8 && md.getDatabaseMinorVersion() >= 4) {
				return "SHOW BINARY LOG STATUS";
			}
		} catch ( SQLException e ) {
		}

		return "SHOW MASTER STATUS";
	}

https://dev.mysql.com/doc/refman/8.4/en/show-binary-log-status.html
https://dev.mysql.com/doc/refman/8.0/en/show-master-status.html

@Tang-RoseChild
Copy link

@osheroff
hi, please take a look at it, if should fix it, then release a new version ? current v1.41.2 doesn't support mysql 8.4.xx

Thanks a lot

@CharanSriramula
Copy link

@osheroff please look into this, I'am also facing this issue.
We are using aurora mysql with inno db engine (8.0.32).
SHOW MASTER STATUS command works fine, but SHOW BINARY LOG STATUS is failing.

@CharanSriramula
Copy link

@I-Like-Pepsi

Temporary fix without building your own maxwell jar:

execute this INSERT command:

insert into maxwell.positions(server_id, binlog_file, binlog_position, gtid_set, client_id, heartbeat_at, last_heartbeat_read)
values (123, 'mysql-bin-changelog.xxxx', 0, null, 'maxwell', null, 0);

  1. Fetch server id using: select @@server_id
  2. Fetch binlog file name: SHOW BINARY LOGS

Replace values according to your necessity.

Once you execute this command, start the maxwell instance.
This works because, the SHOW BINARY LOG STATUS / SHOW MASTER STATUS query executes only if there is no entry in positions table. Once you populate the positions table, maxwell will pick the row from it.

Thanks.

@osheroff
Copy link
Collaborator

problem with the latest release patching shortly.

@osheroff
Copy link
Collaborator

fixed in 1.42.1, plz upgrade

@CharanSriramula
Copy link

Thank you @osheroff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants