commit a7f6a6e: [Minor] Use descriptive variable name

Anton Yuzhaninov citrin+git at citrin.ru
Wed Aug 5 10:21:13 UTC 2020


Author: Anton Yuzhaninov
Date: 2020-07-29 16:49:06 +0100
URL: https://github.com/rspamd/rspamd/commit/a7f6a6ed078911b9ee76e63eed5da631aa78a845 (refs/pull/3455/head)

[Minor] Use descriptive variable name
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 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 3a4b1f802..578a35365 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -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


More information about the Commits mailing list