[Rspamd-Users] clickhouse maintenance

Javier Angulo javier at jangulo.net
Fri Sep 6 10:52:40 UTC 2019


Hi guys,

my clickhouse partitions are not getting detached even if I have at
/etc/rspamd/local.d/clickhouse.conf:

retention {
  enable = true;
  #  # drop | detach, please refer to ClickHouse docs for details
  #  #
http://clickhouse-docs.readthedocs.io/en/latest/query_language/queries.html#manipulations-with-partitions-and-parts
  method = "drop";
  #  # how many month the data should be kept in ClickHouse
  period_months = 1;
  #  # how often run the cleanup process
  run_every = "1h";
}

Errors shown:

Sep  6 10:10:27 lp-smtp-rspamdfeed rspamd[3965]: <969trx>; lua;
clickhouse.lua:765: cannot detach partition rspamd:2019-07-29 from
server 10.7.80.157:8443: Code: 53, e.displayText() = DB::Exception: Type
mismatch in IN or VALUES section. Expected: Date. Got: Int64 (version
19.13.3.26)\0a

It seems that PARTITION name need to be escaped because if I change:

$ diff /usr/share/rspamd/plugins/clickhouse.lua
/usr/share/rspamd/plugins/clickhouse.lua.copy
747c747
<   local remove_partition_sql = "ALTER TABLE ${table_name}
${remove_method} PARTITION '${partition_id}'"
---
>   local remove_partition_sql = "ALTER TABLE ${table_name}
${remove_method} PARTITION ${partition_id}"

clickhouse partitions are removed successfully.

I do not feel confident to make a pull request due to my zero lua
knowledge, but this seems to work for me.

Cheers,

Javier.



More information about the Users mailing list