From 08c235a50c2003aa5e08ede496c38ca4644780b3 Mon Sep 17 00:00:00 2001 From: StrikeW Date: Mon, 4 Mar 2024 15:50:18 +0800 Subject: [PATCH] quick workaround --- e2e_test/source/cdc/mysql_cdc.sql | 9 +++++---- .../connector/source/common/MySqlValidator.java | 10 ++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/e2e_test/source/cdc/mysql_cdc.sql b/e2e_test/source/cdc/mysql_cdc.sql index dd1a1f70628a..0ac47fc7fbd1 100644 --- a/e2e_test/source/cdc/mysql_cdc.sql +++ b/e2e_test/source/cdc/mysql_cdc.sql @@ -49,13 +49,14 @@ VALUES (1,1,'no'), (3,3,'no'), (4,4,'no'); --- user rwcdc used for shared mysql source -CREATE USER 'rwcdc'@'%' IDENTIFIED BY '123456'; -GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'rwcdc'@'%'; - CREATE USER 'dbz'@'%' IDENTIFIED BY '123456'; GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'dbz'@'%'; +CREATE USER 'rwcdc'@'%' IDENTIFIED BY '123456'; +GRANT SELECT, RELOAD, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'rwcdc'@'%'; + +FLUSH PRIVILEGES; + CREATE TABLE tt3 (v1 int primary key, v2 timestamp); INSERT INTO tt3 VALUES (1, '2020-07-30 10:08:22'); INSERT INTO tt3 VALUES (2, '2020-07-31 10:09:22'); diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java index b01dd76b001b..2c6cee3dfba7 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/MySqlValidator.java @@ -181,16 +181,10 @@ private void validateTableSchema() throws SQLException { } private void validatePrivileges() throws SQLException { - final String[] dedicatedSourcePrivileges = { - "SELECT", "RELOAD", "SHOW DATABASES", "REPLICATION SLAVE", "REPLICATION CLIENT", + String[] privilegesRequired = { + "SELECT", "RELOAD", "REPLICATION SLAVE", "REPLICATION CLIENT", }; - final String[] sharedSourcePrivileges = { - "SELECT", "REPLICATION SLAVE", "REPLICATION CLIENT", - }; - - String[] privilegesRequired = - isMultiTableShared ? sharedSourcePrivileges : dedicatedSourcePrivileges; var hashSet = new HashSet<>(List.of(privilegesRequired)); try (var stmt = jdbcConnection.createStatement()) { var res = stmt.executeQuery(ValidatorUtils.getSql("mysql.grants"));