emqx icon indicating copy to clipboard operation
emqx copied to clipboard

MySQL 认证 将MySQL库换成Ocenbase后报错

Open songeddy opened this issue 1 year ago • 1 comments

What happened?

Ocenbase兼容MySQL驱动,EMQX采用MySQL认证底层数据库换成Ocenbase后报错如下: image

{emqx_auth_mysql,{bad_return,{{emqx_auth_mysql_app,start,[normal,[]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,emqx_auth_mysql,{shutdown,{failed_to_start_child,worker_sup,{shutdown,{failed_to_start_child,{worker,1},{{badmatch,32},[{mysql_protocol,handshake_finish_or_switch_auth,5,[{file,"mysql_protocol.erl"},{line,114}]},{mysql_conn,handshake,1,[{file,"mysql_conn.erl"},{line,202}]},{mysql_conn,'-connect/1-fun-0-',2,[{file,"mysql_conn.erl"},{line,137}]}]}}}}}}}}},[{emqx_auth_mysql_app,start,2,[{file,"emqx_auth_mysql_app.erl"},{line,38}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,293}]}]}}}}}

What did you expect to happen?

能够支持Ocenbase数据库。

How can we reproduce it (as minimally and precisely as possible)?

MySQL 认证 将MySQL库换成Ocenbase。

Anything else we need to know?

No response

EMQX version

$ ./bin/emqx_ctl broker
# paste output here

OS version

# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

Log files

songeddy avatar Sep 25 '24 01:09 songeddy

we need someone with the mysql protocol level knowledge to help supporting ocenbase in the mysql lib https://github.com/emqx/mysql-otp

zmstone avatar Sep 28 '24 09:09 zmstone

@zmstone I am also using Ocenbase and found that the server status returned by MySQL is different.Ocenbase server status is '0x0022',MySQL server status is '0x0002',Will this server status have any impact? image image

x3pp avatar Oct 23 '24 01:10 x3pp

Server status code 0x0022 seems to be the 'OR' result of 0x0020 and 0x0002

  • 0x0020: means no index was used in the query, i am unsure why connect or authentication should result in this flag being set.
  • 0x0002: is the flag intentionally ignored by mysql client implementation

I suppose we can ignore the 0x0020 flag as well, but I have no idea when we'll be able to work on this because we have a lot of work from paying customers.

zmstone avatar Oct 29 '24 22:10 zmstone

I have made modifications to the source code of version 4.4.19, and the git address is https://github.com/changdong123/emqx.git.

changdong123 avatar Jan 06 '25 11:01 changdong123

1736163942615 You need to modify the MySQL driver address in rebar.config in the emqx source code

changdong123 avatar Jan 06 '25 11:01 changdong123

@songeddy could you help to send a pull-request to https://github.com/emqx/mysql-otp

zmstone avatar Jan 07 '25 09:01 zmstone

EMQX 4.4 has reached EOL though, if you help to enhance mysql-otp, we will be able to upgrade it in version 5.

zmstone avatar Jan 07 '25 09:01 zmstone

Hi @changdong123,I think add new server_status SERVER_STATUS_NO_INDEX_USED_AUTOCOMMIT is wrong method, although it should still work fine. A new status code should not be added (the mysql official documentation does not have 0x0022).

x3pp avatar Jan 09 '25 04:01 x3pp

SERVER_STATUS_NO_INDEX_USED_AUTOCOMMIT is 0x0020, not 0x0022

This status bit will be allowed by EMQX 5.8.6, closing this issue.

zmstone avatar Mar 11 '25 10:03 zmstone

https://github.com/emqx/mysql-otp/pull/16

zmstone avatar Mar 11 '25 10:03 zmstone