Skip to content

Commit

Permalink
Added condition for exchange manager properties file creation.
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Waś <jan@was.net.pl>
  • Loading branch information
yardenc2003 and nineinchnick committed Sep 20, 2024
1 parent 2dc0147 commit 25c3851
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 10 deletions.
21 changes: 19 additions & 2 deletions charts/trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,25 @@ Fast distributed SQL query engine for big data analytics that helps you explore

Trino supports multiple [authentication types](https://trino.io/docs/current/security/authentication-types.html): PASSWORD, CERTIFICATE, OAUTH2, JWT, KERBEROS.
* `server.config.query.maxMemory` - string, default: `"4GB"`
* `server.exchangeManager.name` - string, default: `"filesystem"`
* `server.exchangeManager.baseDir` - string, default: `"/tmp/trino-local-file-system-exchange-manager"`
* `server.exchangeManager` - object, default: `{}`

Mandatory [exchange manager configuration](https://trino.io/docs/current/admin/fault-tolerant-execution.html#id1).
Used to set the name and location(s) of the spooling storage destination.
* To enable fault-tolerant execution, you must set the `retry-policy` property in `additionalConfigProperties`.
* Additional exchange manager configurations can be added to `additionalExchangeManagerProperties`.
Example:
```yaml
server:
exchangeManager:
name: "filesystem"
baseDir: "/tmp/trino-local-file-system-exchange-manager"
additionalConfigProperties:
- retry-policy=TASK
additionalExchangeManagerProperties:
- exchange.sink-buffer-pool-min-size=10
- exchange.sink-buffers-per-partition=2
- exchange.source-concurrent-readers=4
```
* `server.workerExtraConfig` - string, default: `""`
* `server.coordinatorExtraConfig` - string, default: `""`
* `server.autoscaling.enabled` - bool, default: `false`
Expand Down
4 changes: 2 additions & 2 deletions charts/trino/templates/configmap-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ data:
resource-groups.config-file={{ .Values.server.config.path }}/resource-groups/resource-groups.json
{{- end }}

{{- if .Values.server.exchangeManager }}
exchange-manager.properties: |
exchange-manager.name={{ .Values.server.exchangeManager.name }}
{{ if eq .Values.server.exchangeManager.name "filesystem" }}
exchange.base-directories={{ .Values.server.exchangeManager.baseDir }}
{{- end }}
{{- range $configValue := .Values.additionalExchangeManagerProperties }}
{{ $configValue }}
{{- end }}
{{- end }}

log.properties: |
io.trino={{ .Values.server.log.trino.level }}
Expand Down
4 changes: 2 additions & 2 deletions charts/trino/templates/configmap-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ data:
{{- .Values.server.workerExtraConfig | nindent 4 }}
{{- end }}
{{- if .Values.server.exchangeManager }}
exchange-manager.properties: |
exchange-manager.name={{ .Values.server.exchangeManager.name }}
{{ if eq .Values.server.exchangeManager.name "filesystem" }}
exchange.base-directories={{ .Values.server.exchangeManager.baseDir }}
{{- end }}
{{- range $configValue := .Values.additionalExchangeManagerProperties }}
{{ $configValue }}
{{- end }}
{{- end }}

log.properties: |
io.trino={{ .Values.server.log.trino.level }}
Expand Down
24 changes: 21 additions & 3 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,27 @@ server:
authenticationType: ""
query:
maxMemory: "4GB"
exchangeManager:
name: "filesystem"
baseDir: "/tmp/trino-local-file-system-exchange-manager"
exchangeManager: {}
# server.exchangeManager -- Mandatory [exchange manager
# configuration](https://trino.io/docs/current/admin/fault-tolerant-execution.html#id1).
# @raw
# Used to set the name and location(s) of the spooling storage destination.
# * To enable fault-tolerant execution, you must set the `retry-policy` property in `additionalConfigProperties`.
# * Additional exchange manager configurations can be added to `additionalExchangeManagerProperties`.
# Example:
# ```yaml
# server:
# exchangeManager:
# name: "filesystem"
# baseDir: "/tmp/trino-local-file-system-exchange-manager"
# additionalConfigProperties:
# - retry-policy=TASK
# additionalExchangeManagerProperties:
# - exchange.sink-buffer-pool-min-size=10
# - exchange.sink-buffers-per-partition=2
# - exchange.source-concurrent-readers=4
# ```

workerExtraConfig: ""
coordinatorExtraConfig: ""
autoscaling:
Expand Down
35 changes: 35 additions & 0 deletions test-exchange-manager-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Exchange Manager values to test.
# This is a YAML-formatted file.

coordinator:
additionalVolumes:
- name: exchange-volume
persistentVolumeClaim:
claimName: exchange-manager-pvc

additionalVolumeMounts:
- name: exchange-volume
mountPath: "/tmp/trino-local-file-system-exchange-manager"

worker:
additionalVolumes:
- name: exchange-volume
persistentVolumeClaim:
claimName: exchange-manager-pvc

additionalVolumeMounts:
- name: exchange-volume
mountPath: "/tmp/trino-local-file-system-exchange-manager"

server:
exchangeManager:
name: "filesystem"
baseDir: "/tmp/trino-local-file-system-exchange-manager"

additionalConfigProperties:
- retry-policy=TASK

additionalExchangeManagerProperties:
- exchange.sink-buffer-pool-min-size=10
- exchange.sink-buffers-per-partition=2
- exchange.source-concurrent-readers=4
15 changes: 14 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare -A testCases=(
[complete_values]="--values test-values.yaml"
[overrides]="--set coordinatorNameOverride=coordinator-overridden,workerNameOverride=worker-overridden,nameOverride=overridden"
[access_control_properties_values]="--values test-access-control-properties-values.yaml"
[exchange_manager_values]="--values test-exchange-manager-values.yaml"
)

function join_by {
Expand All @@ -22,7 +23,7 @@ NAMESPACE=trino-$(LC_ALL=C tr -dc 'a-z0-9' </dev/urandom | head -c 6 || true)
HELM_EXTRA_SET_ARGS=
CT_ARGS=(--charts=charts/trino --skip-clean-up --helm-extra-args="--timeout 2m")
CLEANUP_NAMESPACE=true
TEST_NAMES=(default single_node complete_values access_control_properties_values)
TEST_NAMES=(default single_node complete_values access_control_properties_values exchange_manager_values)

usage() {
cat <<EOF 1>&2
Expand Down Expand Up @@ -74,6 +75,18 @@ openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \

kubectl create namespace "$NAMESPACE" --dry-run=client --output yaml | kubectl apply --filename -
kubectl -n "$NAMESPACE" create secret tls certificates --cert=cert.crt --key=cert.key --dry-run=client --output yaml | kubectl apply --filename -
cat <<YAML | kubectl -n "$NAMESPACE" apply -f-
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: exchange-manager-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 128Mi
YAML

# only install the Prometheus Helm chart when running the `complete_values` test
if printf '%s\0' "${TEST_NAMES[@]}" | grep -qwz complete_values; then
Expand Down

0 comments on commit 25c3851

Please sign in to comment.