[Rspamd-Users] clickhouse maintenance

Vsevolod Stakhov vsevolod at rspamd.com
Sun Sep 8 13:16:17 UTC 2019


On 06/09/2019 11:52, Javier Angulo wrote:
> 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.
> 

Hello,


Thank you for your report. The fix is now committed:
https://github.com/rspamd/rspamd/commit/76b863e79e39ec5e1c99cee6e4263abe02f6f8d0


More information about the Users mailing list