-
Notifications
You must be signed in to change notification settings - Fork 416
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
[#6467] improve(core): Allow JDBC backend configs be configurable #6469
Conversation
0b2769e
to
3b9872f
Compare
@yuqi1129 can you please help to review? |
All suggestions have been incorporated. Thank you for your thorough review! |
lgtm |
@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. |
b61add5
to
9aa62a3
Compare
done |
@jerqi @jerryshao @tengqm |
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.
just a minor.
docs/gravitino-server-config.md
Outdated
| `gravitino.entity.store.relational.jdbcPassword` | The password that the `JDBCBackend` needs to use when connecting the database. It is required for `MySQL`. | `gravitino` | Yes if the jdbc connection url is not `jdbc:h2` | 0.5.0 | | ||
| `gravitino.entity.store.relational.storagePath` | The storage path for embedded JDBC storage implementation. It supports both absolute and relative path, if the value is a relative path, the final path is `${GRAVITINO_HOME}/${PATH_YOU_HAVA_SET}`, default value is `${GRAVITINO_HOME}/data/jdbc` | `${GRAVITINO_HOME}/data/jdbc` | No | 0.6.0-incubating | | ||
| `gravitino.entity.store.relational.maxConnections`| The maximum number of connections for the JDBC Backend connection pool | `100` | No | 0.9.0 | | ||
| `gravitino.entity.store.relational.maxWaitMillis` | The maximum wait time in milliseconds for a connection from the JDBC Backend connection pool | `1000` | No | 0.9.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.
0.9.0-incubting.
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.
done thank u
9aa62a3
to
b9c1461
Compare
You should modify the PR description to align to the latest code. |
What changes were proposed in this pull request?
gravitino.entity.store.relational.maxConnections
andgravitino.entity.store.relational.maxWaitMillis
to control the connection pool when connecting to the JDBC storage backend.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