Skip to content

Commit 2d65eee

Browse files
committed
Use "org.apache.derby.iapi.jdbc.AutoloadedDriver" for derby in 4.2.0
1 parent 59de3cf commit 2d65eee

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

deploy/config-spec/properties.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ properties:
8484
unit: *unitClassName
8585
roles:
8686
- name: "metastore"
87-
required: true
87+
# This property *is* required. It changed for derby in version 4.2.0
88+
# which we check in code and add in the ConfigMap builder instead of
89+
# the compute_files() method in crd.rs.
90+
required: false
8891
asOfVersion: "0.0.0"
8992
- property:
9093
propertyNames:

deploy/helm/hive-operator/configs/properties.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ properties:
8484
unit: *unitClassName
8585
roles:
8686
- name: "metastore"
87-
required: true
87+
# This property *is* required. It changed for derby in version 4.2.0
88+
# which we check in code and add in the ConfigMap builder instead of
89+
# the compute_files() method in crd.rs.
90+
required: false
8891
asOfVersion: "0.0.0"
8992
- property:
9093
propertyNames:

rust/operator-binary/src/controller.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,15 @@ fn build_metastore_rolegroup_config_map(
607607
Some("/stackable/warehouse".to_string()),
608608
);
609609

610+
data.insert(
611+
MetaStoreConfig::CONNECTION_DRIVER_NAME.to_string(),
612+
Some(
613+
hive.db_type()
614+
.get_jdbc_driver_class(&resolved_product_image.product_version)
615+
.to_string(),
616+
),
617+
);
618+
610619
if let Some(s3) = s3_connection_spec {
611620
data.insert(
612621
MetaStoreConfig::S3_ENDPOINT.to_string(),

rust/operator-binary/src/crd/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,16 @@ pub enum DbType {
521521
}
522522

523523
impl DbType {
524-
pub fn get_jdbc_driver_class(&self) -> &str {
524+
pub fn get_jdbc_driver_class(&self, product_version: &str) -> &str {
525525
match self {
526-
DbType::Derby => "org.apache.derby.jdbc.EmbeddedDriver",
526+
DbType::Derby => {
527+
// The driver class changed for hive 4.2.0
528+
if ["3.1.3", "4.0.0", "4.0.1", "4.1.0"].contains(&product_version) {
529+
"org.apache.derby.jdbc.EmbeddedDriver"
530+
} else {
531+
"org.apache.derby.iapi.jdbc.AutoloadedDriver"
532+
}
533+
}
527534
DbType::Mysql => "com.mysql.jdbc.Driver",
528535
DbType::Postgres => "org.postgresql.Driver",
529536
DbType::Mssql => "com.microsoft.sqlserver.jdbc.SQLServerDriver",
@@ -598,11 +605,6 @@ impl Configuration for MetaStoreConfigFragment {
598605
MetaStoreConfig::CONNECTION_PASSWORD.to_string(),
599606
Some(DB_PASSWORD_PLACEHOLDER.into()),
600607
);
601-
result.insert(
602-
MetaStoreConfig::CONNECTION_DRIVER_NAME.to_string(),
603-
Some(hive.db_type().get_jdbc_driver_class().to_string()),
604-
);
605-
606608
result.insert(
607609
MetaStoreConfig::METASTORE_METRICS_ENABLED.to_string(),
608610
Some("true".to_string()),

0 commit comments

Comments
 (0)