Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -647,23 +647,36 @@ ch_transport_opts =
ch_transport_opts
end

# Workaround for a ClickHouse bug where sampled queries poison the query
# condition cache, causing subsequent unsampled queries to return invalid
# results. Sampling is EE only, so this is scoped to EE builds.
# Fixed upstream in ClickHouse/ClickHouse#108488; remove once ClickHouse
# updated.
ch_query_condition_cache_settings =
if config_env() in [:ce, :ce_dev, :ce_test] do
[]
else
[use_query_condition_cache: 0]
end

config :plausible, Plausible.ClickhouseRepo,
queue_target: 500,
queue_interval: 2000,
timeout: 15_000,
url: ch_db_url,
transport_opts: ch_transport_opts,
settings: [
readonly: 1,
join_algorithm: "direct,parallel_hash,hash",
# stops queries when :timeout ClickhouseRepo connection :timeout value reached
cancel_http_readonly_queries_on_client_close: 1,
# stops queries when they will likely take over 20s
# NB! when :timeout is overridden to be over 20s,
# for it to have meaningful effect,
# this must be overridden as well
max_execution_time: 20
]
settings:
[
readonly: 1,
join_algorithm: "direct,parallel_hash,hash",
# stops queries when ClickhouseRepo connection :timeout value reached
cancel_http_readonly_queries_on_client_close: 1,
# stops queries when they will likely take over 20s
# NB! when :timeout is overridden to be over 20s,
# for it to have meaningful effect,
# this must be overridden as well
max_execution_time: 20
] ++ ch_query_condition_cache_settings

config :plausible, Plausible.IngestRepo,
queue_target: 500,
Expand Down
Loading