[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

retention {
  enable = true;
  #  # drop | detach, please refer to ClickHouse docs for details
  #  #
  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 Code: 53, e.displayText() = DB::Exception: Type
mismatch in IN or VALUES section. Expected: Date. Got: Int64 (version\0a

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

$ diff /usr/share/rspamd/plugins/clickhouse.lua
<   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.



More information about the Users mailing list