-
Notifications
You must be signed in to change notification settings - Fork 407
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
base: main
Are you sure you want to change the base?
Conversation
0b2769e
to
3b9872f
Compare
@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; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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`") |
There was a problem hiding this comment.
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`") |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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' ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
All suggestions have been incorporated. Thank you for your thorough review! |
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@TEOTEO520 |
974b2fc
to
727d369
Compare
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
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
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
I think you should also update the related documents about newly added configurations. |
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