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

[feate] Added support for postgresql based on dev-1.4.0 #4524

Merged
merged 15 commits into from May 23, 2023
Merged

[feate] Added support for postgresql based on dev-1.4.0 #4524

merged 15 commits into from May 23, 2023

Conversation

sjgllgh
Copy link
Contributor

@sjgllgh sjgllgh commented May 8, 2023

What is the purpose of the change

  • Added postgresql support for linkis metadata.

Related issues/PRs

Brief change log

  • Modify MybatisConfigurationFactory.java for support multiple data sources.
  • Modify linkis-cg-linkismanager.properties, linkis-mg-gateway.properties and linkis-cg-linkismanager.properties for support multiple data sources.
  • To better distinguish between different data sources, change the original mapper file path. For example, move resources/mapper/common/contextHistoryMapper.xml to resources/mapper/common/mysql/contextHistoryMapper.xml
  • Add mapper files for postgresql. For example, resources/mapper/common/postgresql/contextHistoryMapper.xml
  • Some test classes were added or modified.

How to use postgresql

  1. pom.xml
  • remove test in postgresql's dependency.
  1. linkis.properties
  • Add database connection informations.
  • Add linkis.server.mybatis.pagehelper.dialect=postgresql. The configuration detault value is mysql.
  1. linkis-cg-linkismanager.properties, linkis-mg-gateway.properties and linkis-cg-linkismanager.properties
  • Select mapper files that postgresql can execute.
  1. If you want to use postgresql in test classes, You should change the properties used by the test class.
  • Add database connection informations.
  • Select mapper files that postgresql can execute.
  • Note: Please use the existing postgresql database to test.

Checklist

  • I have read the Contributing Guidelines on pull requests.
  • [ x] I have explained the need for this PR and the problem it solves
  • [ x] I have explained the changes or the new features added to this PR
  • [ x] I have added tests corresponding to this change
  • [ x] I have updated the documentation to reflect this change
  • [ x] I have verified that this change is backward compatible (If not, please discuss on the Linkis mailing list first)
  • [ x] If this is a code change: I have written unit tests to fully verify the new behavior.

Copy link
Contributor

@jackxu2011 jackxu2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the mysql mapper file to resources/mapper/mysql, pgsql to resources/mapper/postgresql, and if the sql file is same, keep the file in the resources/common/.

wds.linkis.log.clear=true
wds.linkis.server.version=v1
##mybatis
wds.linkis.server.mybatis.mapperLocations=classpath*:org/apache/linkis/manager/dao/impl/*.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if have *.xml in package, move to the /mapper/common, or database specific locations

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion. I have modified it according to your suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the config should be modified

@aiceflower
Copy link
Contributor

Please resolve the conflict

@sjgllgh sjgllgh closed this May 12, 2023
@jackxu2011 jackxu2011 reopened this May 15, 2023
Copy link
Contributor

@jackxu2011 jackxu2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jackxu2011
Copy link
Contributor

ping @peacewong

Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@peacewong peacewong merged commit 3db237e into apache:dev-1.4.0 May 23, 2023
10 checks passed
@sjgllgh sjgllgh deleted the dev-1.4.0-support-pgsql branch May 29, 2023 00:53
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

Successfully merging this pull request may close these issues.

None yet

4 participants