rich7420 commented on code in PR #11650:
URL: https://github.com/apache/ozone/pull/11650#discussion_r4557562156
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconControllerModule.java:
##########
@@ -237,6 +237,14 @@ DataSourceConfiguration getDataSourceConfiguration(
ReconSqlDbConfig sqlDbConfig =
ozoneConfiguration.getObject(ReconSqlDbConfig.class);
+ if (StringUtils.startsWith(sqlDbConfig.getJdbcUrl(), "jdbc:derby:")) {
+ LOG.warn("Derby is no longer supported for the Recon SQL DB. Ignoring
the configured {} and using the SQLite "
+ + "defaults.", sqlDbConfig.getJdbcUrl());
+ sqlDbConfig.setDriverClass(ReconSqlDbConfig.DEFAULT_DRIVER_CLASS);
+ sqlDbConfig.setJdbcUrl(ReconSqlDbConfig.DEFAULT_JDBC_URL);
+ sqlDbConfig.setSqlDbDialect(ReconSqlDbConfig.DEFAULT_SQL_DB_DIALECT);
Review Comment:
The SQLite branch below already forces the dialect (its comment even says
the URL alone is enough), so I think only `setJdbcUrl` is needed here. Nothing
reads the driver class on the SQLite path either.
##########
hadoop-ozone/cli-local/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java:
##########
@@ -748,7 +748,7 @@ private int configureRecon(OzoneConfiguration conf,
PersistedPortState persisted
conf.setIfUnset(OZONE_RECON_SCM_DB_DIR, reconDir.toString());
ReconSqlDbConfig dbConfig = conf.getObject(ReconSqlDbConfig.class);
- dbConfig.setJdbcUrl("jdbc:derby:" +
reconDir.resolve("ozone_recon_derby.db"));
+ dbConfig.setJdbcUrl("jdbc:sqlite:" +
reconDir.resolve("ozone_recon_sqlite.db"));
Review Comment:
Since the default URL is now `${ozone.recon.db.dir}/ozone_recon_sqlite.db`,
I think these three lines can just go. Bonus: the SQL DB would then follow a
user-set `ozone.recon.db.dir` instead of always landing in the local data dir.
(Same for `ReconService` in the IT.)
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconSchemaManager.java:
##########
@@ -44,14 +44,23 @@ public ReconSchemaManager(Set<ReconSchemaDefinition>
reconSchemaDefinitions) {
@VisibleForTesting
public void createReconSchema() {
+ createReconSchema(ReconVersion.SOFTWARE_VERSION);
+ }
+
+ /**
+ * Create the Recon SQL tables.
+ *
+ * @param freshInstallVersion version recorded when the SQL DB is new
+ */
+ public void createReconSchema(ReconVersion freshInstallVersion) {
try {
// Initialize the schema version table first
reconSchemaDefinitions.stream()
.filter(SchemaVersionTableDefinition.class::isInstance)
.findFirst()
.ifPresent(schemaDefinition -> {
SchemaVersionTableDefinition schemaVersionTable =
(SchemaVersionTableDefinition) schemaDefinition;
-
schemaVersionTable.setSoftwareVersion(ReconVersion.SOFTWARE_VERSION.serialize());
+
schemaVersionTable.setSoftwareVersion(freshInstallVersion.serialize());
Review Comment:
This can be `INITIAL_VERSION` now, so `setSoftwareVersion` reads a bit off.
Maybe rename it? Or just skip the insert for an existing install, since no row
already means `INITIAL_VERSION` in `ReconVersionManager`.
##########
hadoop-hdds/common/src/main/resources/ozone-default.xml:
##########
@@ -3575,7 +3575,7 @@
<value>10000</value>
<tag>OZONE, RECON</tag>
<description>
- Number of rows Derby returns per JDBC round-trip when streaming unhealthy
+ Number of rows the Recon SQL DB returns per JDBC round-trip when
streaming unhealthy
Review Comment:
sqlite-jdbc ignores the fetch size (`setFetchSize` just stores the value),
so this doesn't really apply with the default DB. Maybe mention that SQLite
ignores it? Same for the fetch size bullet in
`TestUnhealthyContainersSqlitePerformance`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]