From 7ce04913e32d553ee8f2d9df3f9e4f7f2dbce1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=93=D0=B0=D1=80?= =?UTF-8?q?=D0=B1=D0=B0=D1=80?= Date: Thu, 6 Jun 2024 16:49:14 +0300 Subject: [PATCH] Limit insert dedup info query log length --- ch_backup/clickhouse/client.py | 6 +++++- ch_backup/clickhouse/control.py | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ch_backup/clickhouse/client.py b/ch_backup/clickhouse/client.py index 6ca5db69..1ff865e9 100644 --- a/ch_backup/clickhouse/client.py +++ b/ch_backup/clickhouse/client.py @@ -44,12 +44,16 @@ def query( post_data: dict = None, settings: dict = None, timeout: float = None, + log_entry_length: int = None, ) -> Any: """ Execute query. """ try: - logging.debug("Executing query: {}", query) + logging.debug( + "Executing query: {}", + query if not log_entry_length else query[:log_entry_length] + "...", + ) if timeout is None: timeout = self.timeout diff --git a/ch_backup/clickhouse/control.py b/ch_backup/clickhouse/control.py index 73c73f00..2e8fda47 100644 --- a/ch_backup/clickhouse/control.py +++ b/ch_backup/clickhouse/control.py @@ -932,7 +932,8 @@ def insert_deduplication_info(self, batch: List[str]) -> None: system_db=escape(self._backup_config["system_database"]), table="_deduplication_info", batch=",".join(batch), - ) + ), + log_entry_length=150, ) def get_deduplication_info( @@ -959,7 +960,8 @@ def get_deduplication_info( system_db=escape(self._backup_config["system_database"]), table="_deduplication_info_current", batch=",".join(batch), - ) + ), + log_entry_length=150, ) result_json = self._ch_client.query( GET_DEDUPLICATED_PARTS_SQL.format(