commit 6e571d7: [Minor] Clickhouse: Implement schema addtions
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Mar 22 12:49:03 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-03-22 12:42:56 +0000
URL: https://github.com/rspamd/rspamd/commit/6e571d7929b3a5c37f0f31e53ab030b7b44c7130 (HEAD -> master)
[Minor] Clickhouse: Implement schema addtions
---
src/plugins/lua/clickhouse.lua | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index a9caa5292..6fc611cef 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -59,6 +59,7 @@ local settings = {
subject_privacy_alg = 'blake2', -- default hash-algorithm to obfuscate subject
subject_privacy_prefix = 'obf', -- prefix to show it's obfuscated
subject_privacy_length = 16, -- cut the length of the hash
+ schema_additions = {}, -- additional SQL statements to be executed when schema is uploaded
user = nil,
password = nil,
no_ssl_verify = false,
@@ -731,7 +732,7 @@ local function upload_clickhouse_schema(upstream, ev_base, cfg)
}
-- Apply schema sequentially
- for i,v in ipairs(clickhouse_schema) do
+ fun.each(function(v)
local sql = v
local err, _ = lua_clickhouse.generic_sync(upstream, settings, ch_params, sql)
@@ -740,9 +741,9 @@ local function upload_clickhouse_schema(upstream, ev_base, cfg)
sql, upstream:get_addr():to_string(true), err)
return
end
- rspamd_logger.infox(rspamd_config, 'uploaded clickhouse schema element %s to %s',
- i, upstream:get_addr():to_string(true))
- end
+ rspamd_logger.debugm(N, rspamd_config, 'uploaded clickhouse schema element %s to %s',
+ v, upstream:get_addr():to_string(true))
+ end, fun.chain(clickhouse_schema, settings.schema_additions))
end
local function maybe_apply_migrations(upstream, ev_base, cfg, version)
More information about the Commits
mailing list