Skip to content

[Bug] [dolphinscheduler-api] datasource update input error password , still update success. #10270

@caoes

Description

@caoes

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

First, enter the correct data source account password for connection test, wait for the message that the link is successful, save the data source. Then edit the data source, enter the wrong password for editing, editing success.

What you expected to happen

org.apache.dolphinscheduler.plugin.datasource.api.datasourceAbstractDatasourceProcessor##getDatasourceUniqueId method
Generate a unique key based only on the type data source user and link information, and skip authentication if the password is incorrect.
It is currently found that the mysql data source occasionally requires additional information to connect successfully.{"serverTimezone":"Asia/Shanghai"}
Other information must be configured for Hive data type ZK cluster connection mode. If other information is modified, the database cannot be connected .{"serviceDiscoveryMode":"zooKeeper","zooKeeperNamespace":"hiveserver2_zk"}

` public Connection getConnection(DbType dbType, ConnectionParam connectionParam) {
BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam;
String datasourceUniqueId = DatasourceUtil.getDatasourceUniqueId(baseConnectionParam, dbType);
logger.info("getConnection datasourceUniqueId {}", datasourceUniqueId);

    DataSourceClient dataSourceClient = uniqueId2dataSourceClientMap.computeIfAbsent(datasourceUniqueId, $ -> {
        Map<String, DataSourceChannel> dataSourceChannelMap = dataSourcePluginManager.getDataSourceChannelMap();
        DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getDescp());
        if (null == dataSourceChannel) {
            throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getDescp()));
        }
        return dataSourceChannel.createDataSourceClient(baseConnectionParam, dbType);
    });
    return dataSourceClient.getConnection();
}`

**public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) { BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam; return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getDescp(), baseConnectionParam.getUser(), baseConnectionParam.getPassword(), baseConnectionParam.getJdbcUrl()); }**

How to reproduce

First, enter the correct data source account password for connection test, wait for the message that the link is successful, save the data source. Then edit the data source, enter the wrong password for editing, editing success.

Anything else

No response

Version

2.0.5

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions