Skip to content

Commit 9132bcc

Browse files
committed
feat: Add support for Trino 481
1 parent df02b1f commit 9132bcc

4 files changed

Lines changed: 54 additions & 45 deletions

File tree

rust/operator-binary/src/catalog/commons.rs

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl ExtendCatalogConfig for s3::v1alpha1::InlineConnectionOrReference {
8080
_catalog_name: &str,
8181
catalog_namespace: Option<String>,
8282
client: &Client,
83-
trino_version: u16,
83+
_trino_version: u16,
8484
) -> Result<(), FromTrinoCatalogError> {
8585
let s3 = self
8686
.clone()
@@ -97,48 +97,21 @@ impl ExtendCatalogConfig for s3::v1alpha1::InlineConnectionOrReference {
9797
catalog_config.volumes.extend(volumes);
9898
catalog_config.volume_mounts.extend(mounts);
9999

100-
if trino_version >= 469 {
101-
// Since Trino 469, S3 native support has to be explicitly enabled
102-
// unless using Legacy S3 support (which has been deprecated in 470).
103-
catalog_config.add_property("fs.native-s3.enabled", "true");
104-
}
105-
106-
let (endpoint_prop, region_prop, path_style_prop) = match trino_version {
107-
..=468 => (
108-
"hive.s3.endpoint",
109-
"hive.s3.region",
110-
"hive.s3.path-style-access",
111-
),
112-
469.. => ("s3.endpoint", "s3.region", "s3.path-style-access"),
113-
};
114-
catalog_config.add_property(endpoint_prop, s3.endpoint().context(ConfigureS3Snafu)?);
115-
catalog_config.add_property(region_prop, &s3.region.name);
100+
catalog_config.add_property("fs.native-s3.enabled", "true");
101+
catalog_config.add_property("s3.endpoint", s3.endpoint().context(ConfigureS3Snafu)?);
102+
catalog_config.add_property("s3.region", &s3.region.name);
116103
catalog_config.add_property(
117-
path_style_prop,
104+
"s3.path-style-access",
118105
(s3.access_style == s3::v1alpha1::S3AccessStyle::Path).to_string(),
119106
);
120107

121108
if let Some((access_key, secret_key)) = s3.credentials_mount_paths() {
122-
let (access_key_prop, secret_key_prop) = match trino_version {
123-
..=468 => ("hive.s3.aws-access-key", "hive.s3.aws-secret-key"),
124-
469.. => ("s3.aws-access-key", "s3.aws-secret-key"),
125-
};
126-
catalog_config.add_env_property_from_file(access_key_prop, access_key);
127-
catalog_config.add_env_property_from_file(secret_key_prop, secret_key);
109+
catalog_config.add_env_property_from_file("s3.aws-access-key", access_key);
110+
catalog_config.add_env_property_from_file("s3.aws-secret-key", secret_key);
128111
}
129112

130-
match trino_version {
131-
// Older trino versions allowed TLS to be optional
132-
..=468 => {
133-
if !s3.tls.uses_tls() {
134-
tracing::warn!("from Trino 460, TLS will be required for S3 connections");
135-
}
136-
catalog_config.add_property("hive.s3.ssl.enabled", s3.tls.uses_tls().to_string());
137-
}
138-
// TLS is required when using native S3 implementation.
139-
// https://trino.io/docs/469/object-storage/legacy-s3.html#migration-to-s3-file-system
140-
469.. => ensure!(s3.tls.uses_tls(), S3TlsRequiredSnafu),
141-
};
113+
// TLS is required when using native S3 implementation.
114+
ensure!(s3.tls.uses_tls(), S3TlsRequiredSnafu);
142115

143116
if let Some(tls) = s3.tls.tls.as_ref() {
144117
match &tls.verification {

rust/operator-binary/src/config/jvm.rs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ fn recommended_trino_jvm_args(product_version: u16) -> Result<Vec<String>, Error
112112
match product_version {
113113
// Copied from:
114114
// - https://trino.io/docs/477/installation/deployment.html#jvm-config
115-
// - https://trino.io/docs/479/installation/deployment.html#jvm-config
116-
477 | 479 => Ok(vec![
115+
477 => Ok(vec![
117116
"-XX:InitialRAMPercentage=80".to_owned(),
118117
"-XX:MaxRAMPercentage=80".to_owned(),
119118
"-XX:G1HeapRegionSize=32M".to_owned(),
@@ -129,6 +128,44 @@ fn recommended_trino_jvm_args(product_version: u16) -> Result<Vec<String>, Error
129128
"-Dfile.encoding=UTF-8".to_owned(),
130129
"-XX:+EnableDynamicAgentLoading".to_owned(),
131130
]),
131+
// Copied from:
132+
// - https://trino.io/docs/479/installation/deployment.html#jvm-config.
133+
// However, the docs are wrong: https://github.com/trinodb/trino/commit/1ddb0f9976fcd9917aaf0b689ca0acc8635e24f1.
134+
// According to the commit we need to add "--add-modules=jdk.incubator.vector"
135+
479 => Ok(vec![
136+
"-XX:InitialRAMPercentage=80".to_owned(),
137+
"-XX:MaxRAMPercentage=80".to_owned(),
138+
"-XX:G1HeapRegionSize=32M".to_owned(),
139+
"-XX:+ExplicitGCInvokesConcurrent".to_owned(),
140+
"-XX:+ExitOnOutOfMemoryError".to_owned(),
141+
"-XX:+HeapDumpOnOutOfMemoryError".to_owned(),
142+
"-XX:-OmitStackTraceInFastThrow".to_owned(),
143+
"-XX:ReservedCodeCacheSize=512M".to_owned(),
144+
"-XX:PerMethodRecompilationCutoff=10000".to_owned(),
145+
"-XX:PerBytecodeRecompilationCutoff=10000".to_owned(),
146+
"-Djdk.attach.allowAttachSelf=true".to_owned(),
147+
"-Djdk.nio.maxCachedBufferSize=2000000".to_owned(),
148+
"-Dfile.encoding=UTF-8".to_owned(),
149+
"-XX:+EnableDynamicAgentLoading".to_owned(),
150+
"--add-modules=jdk.incubator.vector".to_owned(),
151+
]),
152+
// Copied from:
153+
// - https://trino.io/docs/481/installation/deployment.html#jvm-config
154+
481 => Ok(vec![
155+
"-XX:InitialRAMPercentage=80".to_owned(),
156+
"-XX:MaxRAMPercentage=80".to_owned(),
157+
"-XX:G1HeapRegionSize=32M".to_owned(),
158+
"-XX:+ExplicitGCInvokesConcurrent".to_owned(),
159+
"-XX:+ExitOnOutOfMemoryError".to_owned(),
160+
"-XX:+HeapDumpOnOutOfMemoryError".to_owned(),
161+
"-XX:-OmitStackTraceInFastThrow".to_owned(),
162+
"-XX:ReservedCodeCacheSize=512M".to_owned(),
163+
"-XX:PerMethodRecompilationCutoff=10000".to_owned(),
164+
"-XX:PerBytecodeRecompilationCutoff=10000".to_owned(),
165+
"-Djdk.attach.allowAttachSelf=true".to_owned(),
166+
"-Djdk.nio.maxCachedBufferSize=2000000".to_owned(),
167+
"--add-modules=jdk.incubator.vector".to_owned(),
168+
]),
132169
_ => TrinoVersionNotSupportedSnafu {
133170
version: product_version,
134171
}

tests/templates/kuttl/smoke/14-assert.yaml.j2

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ commands:
8181
-XX:PerBytecodeRecompilationCutoff=10000
8282
-Djdk.attach.allowAttachSelf=true
8383
-Djdk.nio.maxCachedBufferSize=2000000
84-
-Dfile.encoding=UTF-8
85-
-XX:+EnableDynamicAgentLoading
84+
--add-modules=jdk.incubator.vector
8685
# Arguments from jvmArgumentOverrides
8786
log.properties: |
8887
=info
@@ -765,8 +764,7 @@ commands:
765764
-XX:PerBytecodeRecompilationCutoff=10000
766765
-Djdk.attach.allowAttachSelf=true
767766
-Djdk.nio.maxCachedBufferSize=2000000
768-
-Dfile.encoding=UTF-8
769-
-XX:+EnableDynamicAgentLoading
767+
--add-modules=jdk.incubator.vector
770768
# Arguments from jvmArgumentOverrides
771769
log.properties: |
772770
=info

tests/test-definition.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ dimensions:
2121
values:
2222
- "477"
2323
- "479"
24+
- "481"
2425
# To use a custom image, add a comma and the full name after the product version
25-
# - 477,oci.stackable.tech/sdp/trino:477-stackable0.0.0-dev
26+
# - 481,oci.stackable.tech/sdp/trino:481-stackable0.0.0-dev
2627
- name: trino-latest
2728
values:
28-
- "479"
29+
- "481"
2930
# To use a custom image, add a comma and the full name after the product version
30-
# - 470,oci.stackable.tech/sdp/trino:470-stackable0.0.0-dev
31+
# - 481,oci.stackable.tech/sdp/trino:481-stackable0.0.0-dev
3132
- name: trino-delta
3233
values:
3334
- "477"

0 commit comments

Comments
 (0)