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

[#6467] improve(core): Allow JDBC backend configs be configurable #6469

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

TEOTEO520
Copy link
Contributor

@TEOTEO520 TEOTEO520 commented Feb 17, 2025

What changes were proposed in this pull request?

Add 2 user properties:
gravitino.entity.store.relational.max.total.connection
gravitino.entity.store.relational.max.wait.millis

Why are the changes needed?

To support users to configure JDBC connection pool parameters

Fix: #6467

Does this PR introduce any user-facing change?

No

How was this patch tested?

No need to test

@TEOTEO520 TEOTEO520 force-pushed the feature/support-jdbc-configrable branch from 0b2769e to 3b9872f Compare February 17, 2025 14:50
@jerryshao jerryshao requested a review from yuqi1129 February 18, 2025 02:02
@jerryshao
Copy link
Contributor

@yuqi1129 can you please help to review?

@@ -84,6 +90,10 @@ private Configs() {}

public static final String DEFAULT_RELATIONAL_JDBC_BACKEND_PASSWORD = "gravitino";

public static final int DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION = 100;

public static final long DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION = 1000l;
Copy link
Contributor

Choose a reason for hiding this comment

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

1000l -> 1000L, 1000l can be easily mistaken as 10001.

public static final ConfigEntry<Integer> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION_KEY)
.doc("Max total connect of `JDBCBackend`")
.version(ConfigConstants.VERSION_0_5_0)
Copy link
Contributor

Choose a reason for hiding this comment

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

The version should be 0.9 NOT 0.5

@@ -137,6 +147,20 @@ private Configs() {}
.stringConf()
.createWithDefault(DEFAULT_RELATIONAL_JDBC_BACKEND_PASSWORD);

public static final ConfigEntry<Integer> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION_KEY)
.doc("Max total connect of `JDBCBackend`")
Copy link
Contributor

Choose a reason for hiding this comment

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

The maximum number of connections for the JDBC Backend connection pool.


public static final ConfigEntry<Long> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION_KEY)
.doc("Max max wait millis of `JDBCBackend`")
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -48,6 +48,12 @@ private Configs() {}
public static final String ENTITY_RELATIONAL_JDBC_BACKEND_PASSWORD_KEY =
"gravitino.entity.store.relational.jdbcPassword";

public static final String ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION_KEY =
"gravitino.entity.store.relational.max.total.connection";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please try to shorten the name? gravitino.entity.store.relational.max.total.connection seems to be too long.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe 'gravitino.store.relational.max_connections' ?

Copy link
Contributor

Choose a reason for hiding this comment

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

For last segment, we should use camel style. We should use maxTotalConnection at least.

Copy link
Contributor

Choose a reason for hiding this comment

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

For last segment, we should use camel style. We should use maxTotalConnection at least.

No. For metrics, we don't known what software people are using to consume them. There is a possibility that software is not case sensitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For last segment, we should use camel style. We should use maxTotalConnection at least.

No. For metrics, we don't known what software people are using to consume them. There is a possibility that software is not case sensitive.

Agree, most metrics use Dot-separated Naming Convention

Copy link
Contributor

Choose a reason for hiding this comment

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

But this is a Gravitino config option. We should keep consistent style with Gravitino's other config options instead aligning to other systems.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay. If this is a "config option", then following the established naming style makes sense. If it is the key for an exposed metrics, we'd better follow the industry practices.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But this is a Gravitino config option. We should keep consistent style with Gravitino's other config options instead aligning to other systems.

You're right

@TEOTEO520
Copy link
Contributor Author

All suggestions have been incorporated. Thank you for your thorough review!

@tengqm
Copy link
Contributor

tengqm commented Feb 24, 2025

lgtm

new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION_KEY)
.doc(
"The maximum wait time in milliseconds for a connection from the JDBC Backend connection pool")
.version(ConfigConstants.VERSION_0_5_0)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@yuqi1129
Copy link
Contributor

@TEOTEO520
Please address the comments and try to determine the reason for the CI 's failure.

@TEOTEO520 TEOTEO520 force-pushed the feature/support-jdbc-configrable branch from 974b2fc to 727d369 Compare February 24, 2025 14:34
Comment on lines 51 to 55
public static final String ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION_KEY =
"gravitino.entity.store.relational.max_connections";

public static final String ENTITY_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION_KEY =
"gravitino.entity.store.relational.max_wait_millis";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please be aware that the configuration should be camel-style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, thank you for reviewing

@@ -137,6 +147,21 @@ private Configs() {}
.stringConf()
.createWithDefault(DEFAULT_RELATIONAL_JDBC_BACKEND_PASSWORD);

public static final ConfigEntry<Integer> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION =
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static final ConfigEntry<Integer> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION =
public static final ConfigEntry<Integer> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_CONNECTIONS =

@@ -137,6 +147,21 @@ private Configs() {}
.stringConf()
.createWithDefault(DEFAULT_RELATIONAL_JDBC_BACKEND_PASSWORD);

public static final ConfigEntry<Integer> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION =
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION_KEY)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION_KEY)
new ConfigBuilder(ENTITY_RELATIONAL_JDBC_BACKEND_MAX_CONNECTION_KEYS)

.intConf()
.createWithDefault(DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION);

public static final ConfigEntry<Long> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION =
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static final ConfigEntry<Long> ENTITY_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION =
public static final ConfigEntry<Long> ENTITY_RELATIONAL_JDBC_BACKEND_WAIT_MILLISECONDS =

@@ -84,6 +90,10 @@ private Configs() {}

public static final String DEFAULT_RELATIONAL_JDBC_BACKEND_PASSWORD = "gravitino";

public static final int DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION = 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static final int DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION = 100;
public static final int DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_CONNECTIONS = 100;

@@ -84,6 +90,10 @@ private Configs() {}

public static final String DEFAULT_RELATIONAL_JDBC_BACKEND_PASSWORD = "gravitino";

public static final int DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_TOTAL_CONNECTION = 100;

public static final long DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION = 1000L;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static final long DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLIS_CONNECTION = 1000L;
public static final long DEFAULT_RELATIONAL_JDBC_BACKEND_MAX_WAIT_MILLISECONDS = 1000L;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of your suggestions have been adopted, thank you very much

@tengqm
Copy link
Contributor

tengqm commented Feb 26, 2025

lgtm

@@ -381,6 +381,7 @@ protected String readGitCommitIdFromGitFile() {
String gravitinoHome = System.getenv("GRAVITINO_HOME");
String gitFolder = gravitinoHome + File.separator + ".git" + File.separator;
String headFileContent = FileUtils.readFileToString(new File(gitFolder + "HEAD"), "UTF-8");
LOG.error("\n\n\noooooooooooooooooooooooooooooooooooooooooooooooooooooo" + headFileContent);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could remove this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@jerryshao
Copy link
Contributor

I think you should also update the related documents about newly added configurations.

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.

[Improvement] Allow User Configuration of JDBC Backend Connection Pool Parameters
5 participants