tiflow icon indicating copy to clipboard operation
tiflow copied to clipboard

run as 'syncpoint', can't use password encode by base64

Open knull-cn opened this issue 1 year ago • 5 comments

What did you do?

  1. set 'enable-sync-point=true'
  2. create changefeed as ' tidb -> cdc -> tidb', downstream password was encoded by base64

What did you expect to see?

create changefeed success and sync data to download stream

What did you see instead?

changefeed was occurs erros :

[CDC:ErrMySQLQueryError]fail to query session variable allow_auto_random_explicit_insert: Error 1045: Access denied for user 'cdc'@'10.2.100.15' (using password: YES)

Versions of the cluster

v6.5.0 (all versions which support syncpoint)

knull-cn avatar Jan 20 '24 06:01 knull-cn

https://github.com/pingcap/tiflow/blob/release-6.5/cdc/sink/mysql/mysql.go#L135 here is function NewMySQLSink, and call 'GetTestDB' to create mysql-connection. in this function, it will decode the password when occur error on sql.Open. The function 'GetTestDB' definition is as follows : https://github.com/pingcap/tiflow/blob/release-6.5/pkg/sink/mysql/db_helper.go#L235-L250



the follows code is syncpoint when create mysql-connection. you can see it did not handle error generated by create mysql-connection(sql.Open):

https://github.com/pingcap/tiflow/blob/release-6.5/cdc/sink/mysql/mysql_syncpoint_store.go#L119-L132

knull-cn avatar Jan 20 '24 06:01 knull-cn

BTW: if use base64 to encode password, the DDLSink will be created failed. owner.newDDLSink -> owner.ddlSinkInitializer -> factory.New -> mysql.NewMySQLDDLSink -> mysql.CreateMySQLDBConn

knull-cn avatar Jan 20 '24 06:01 knull-cn

/severity major

fubinzh avatar Jan 22 '24 01:01 fubinzh

cc @knull-cn @flowbehappy This issue only affects v6.5.x.

asddongmen avatar May 13 '24 04:05 asddongmen

I will fix it in the upcoming days.

asddongmen avatar May 13 '24 04:05 asddongmen

fixed by https://github.com/pingcap/tiflow/pull/11162

asddongmen avatar Jun 13 '24 06:06 asddongmen

/found customer

seiya-annie avatar Jun 19 '24 10:06 seiya-annie

/remove-found customer

seiya-annie avatar Jun 19 '24 10:06 seiya-annie