Skip to content

Commit

Permalink
chore(schema-migrator): support for replication (#424)
Browse files Browse the repository at this point in the history
Signed-off-by: Prashant Shahi <[email protected]>
  • Loading branch information
prashant-shahi authored Apr 5, 2024
1 parent 459817c commit 74cfaac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions charts/signoz/templates/schema-migrator/migrations-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ spec:
args:
- "--dsn"
- "tcp://{{ include "schemamigrator.url" . }}?username=$(CLICKHOUSE_USER)&password=$(CLICKHOUSE_PASSWORD)"
{{- if .Values.schemaMigrator.enableReplication }}
- "--replication"
{{- end }}
{{- range .Values.schemaMigrator.args }}
- {{ . | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ spec:
args:
- "--dsn"
- "tcp://{{ include "schemamigrator.url" . }}?username=$(CLICKHOUSE_USER)&password=$(CLICKHOUSE_PASSWORD)"
{{- if .Values.schemaMigrator.enableReplication }}
- "--replication"
{{- end }}
{{- range .Values.schemaMigrator.args }}
- {{ . | quote }}
{{- end }}
Expand Down
5 changes: 4 additions & 1 deletion charts/signoz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,9 @@ schemaMigrator:
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": "before-hook-creation"

# -- Whether to enable replication for schemaMigrator
enableReplication: false

initContainers:
wait:
image:
Expand Down Expand Up @@ -1288,7 +1291,7 @@ schemaMigrator:
sleep 5
continue
fi
current_shards="$(clickhouse client --host ${CLICKHOUSE_HOST} --port ${CLICKHOUSE_PORT} --user "${CLICKHOUSE_USER}" --password "${CLICKHOUSE_PASSWORD}" -q "SELECT count() FROM system.clusters WHERE cluster = '${CLICKHOUSE_CLUSTER}'")"
current_shards="$(clickhouse client --host ${CLICKHOUSE_HOST} --port ${CLICKHOUSE_PORT} --user "${CLICKHOUSE_USER}" --password "${CLICKHOUSE_PASSWORD}" -q "SELECT count(DISTINCT(shard_num)) FROM system.clusters WHERE cluster = '${CLICKHOUSE_CLUSTER}'")"
if [ -z "$current_shards" ]; then
echo "waiting for clickhouse to be ready"
sleep 5
Expand Down

0 comments on commit 74cfaac

Please sign in to comment.