]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use descriptive variable name 3455/head
authorAnton Yuzhaninov <citrin+git@citrin.ru>
Wed, 29 Jul 2020 15:49:06 +0000 (16:49 +0100)
committerAnton Yuzhaninov <citrin+git@citrin.ru>
Tue, 4 Aug 2020 16:58:13 +0000 (17:58 +0100)
PARTITION and PARTITION ID in ClickHouse are different:
https://clickhouse.tech/docs/en/sql-reference/statements/alter/partition/#alter-how-to-specify-part-expr
and we use PARTITION clause here.

src/plugins/lua/clickhouse.lua

index 3a4b1f802831fc6deb35d4b9dbcd02f8cdbeb805..578a35365b5dcf2a53e97fe54f2c5b56c370e8c2 100644 (file)
@@ -864,15 +864,15 @@ local function clickhouse_collect(task)
       used_memory, settings.limits.max_memory)
 end
 
-local function do_remove_partition(ev_base, cfg, table_name, partition_id)
-  lua_util.debugm(N, rspamd_config, "removing partition %s.%s", table_name, partition_id)
+local function do_remove_partition(ev_base, cfg, table_name, partition)
+  lua_util.debugm(N, rspamd_config, "removing partition %s.%s", table_name, partition)
   local upstream = settings.upstream:get_upstream_round_robin()
-  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}'"
   local remove_method = (settings.retention.method == 'drop') and 'DROP' or 'DETACH'
   local sql_params = {
     ['table_name']     = table_name,
     ['remove_method']  = remove_method,
-    ['partition_id']   = partition_id
+    ['partition']   = partition
   }
 
   local sql = lua_util.template(remove_partition_sql, sql_params)
@@ -887,13 +887,13 @@ local function do_remove_partition(ev_base, cfg, table_name, partition_id)
   if err then
     rspamd_logger.errx(rspamd_config,
       "cannot detach partition %s:%s from server %s: %s",
-      table_name, partition_id,
+      table_name, partition,
       settings['server'], err)
     return
   end
 
   rspamd_logger.infox(rspamd_config,
-      'detached partition %s:%s on server %s', table_name, partition_id,
+      'detached partition %s:%s on server %s', table_name, partition,
       settings['server'])
 
 end