zhoujinsong commented on code in PR #3144:
URL: https://github.com/apache/amoro/pull/3144#discussion_r1736060072
##########
docs/admin-guides/deployment.md:
##########
@@ -129,10 +129,13 @@ ams:
# type: postgres
# jdbc-driver-class: org.postgresql.Driver
# url: jdbc:postgresql://127.0.0.1:5432/amoro
+# init-schema: false
# username: user
# password: passwd
```
+AMS will create tables automatically, if you want to create tables on
yourself, set `ams.database.init-schema` to false.
Review Comment:
You can combine the description with line 113.
##########
amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/AmoroManagementConf.java:
##########
@@ -260,6 +260,12 @@ public class AmoroManagementConf {
.defaultValue("jdbc:derby:/tmp/amoro/derby;create=true")
.withDescription("Database connection address");
+ public static final ConfigOption<Boolean> DB_INIT_SCHEMA =
+ ConfigOptions.key("database.init-schema")
Review Comment:
Is `database.auto-create-tables` a proper name?
##########
amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/AmoroManagementConf.java:
##########
@@ -260,6 +260,12 @@ public class AmoroManagementConf {
.defaultValue("jdbc:derby:/tmp/amoro/derby;create=true")
.withDescription("Database connection address");
+ public static final ConfigOption<Boolean> DB_INIT_SCHEMA =
+ ConfigOptions.key("database.init-schema")
Review Comment:
BTW, we may add this new configuration to our example configuration file.
##########
amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/persistence/SqlSessionFactoryProvider.java:
##########
@@ -123,6 +126,11 @@ public void init(Configurations config) {
* @param config
*/
private void createTablesIfNeed(Configurations config) {
+ boolean initSchema = config.getBoolean(AmoroManagementConf.DB_INIT_SCHEMA);
+ if (!initSchema) {
+ LOG.info("Skip database schema initialize.");
Review Comment:
I recommend adding more log outputs for each situation here:
- the table was created automatically
- the table already exists so there is no need to create it automatically
- automatic creation is not enabled, so the table was not created
automatically.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]