Repository navigation
Add time filters to system log table queries in tests - #96710
Merged
Merged
Conversation
…queries Add `event_date >= yesterday() AND event_time >= now() - 600` filters to all SELECT queries from system log tables (`query_log`, `text_log`, `trace_log`, `part_log`, etc.) in stateless tests. This prevents tests from scanning entire log tables which can be very large in CI, causing timeouts especially under TSan with randomized `max_threads`. Also convert `message` to `message_format_string` in `system.text_log` WHERE clauses where the LIKE pattern matches a known format string constant from the C++ source code. This applies to: - `01165_lost_part_empty_partition` - `01666_merge_tree_max_query_limit` - `02531_two_level_aggregation_bug` - `02581_share_big_sets_between_*_mutation_tasks_long` (both) - `02935_parallel_replicas_settings` Co-Authored-By: Claude Opus 4.6 <[email protected]>
Keep both the time filter from our branch and the renamed logger `processAndOptimizeTextIndexFunctions` from master. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [92449b8] Summary: ❌
|
- `opentelemetry_span_log` has `finish_date`/`finish_time_us` columns, not `event_date`/`event_time` - use `finish_date >= yesterday()` instead - Update echo test reference files to match new query text with time filters https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96710&sha=2963d320da72f69dcc9055aa87bd8f1e56a6c122&name_0=PR&name_1=Fast%20test Co-Authored-By: Claude Opus 4.6 <[email protected]>
- `02417_opentelemetry_insert_on_distributed_table`: same `opentelemetry_span_log` issue - use `finish_date >= yesterday()` instead of non-existent `event_date`/`event_time` - `02813_starting_in_text_log`: remove `event_time >= now() - 600` filter since the "Starting ClickHouse" message is logged at server boot and can be older than 10 minutes in TSan builds Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Resolve merge conflict in 03760_keep_alive_insert_select.sh by taking the master version which uses `message_format_string` and `max_threads=0` - Update 00110_external_sort.reference to match the echoed SQL with time filters Co-Authored-By: Claude Opus 4.6 <[email protected]>
Conflicts resolved: - `00974_text_log_table_not_empty.sh`: kept master's CLICKHOUSE_CLIENT approach with random settings overrides, added `event_time >= now() - 600` filter from our branch - `03707_parquet_metadata_cache.sql`: accepted deletion (reverted in master) Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ouse into fix-system-log-queries
Resolve merge conflicts in `01661_referer.sh` (combine retry loop with time filters) and `02835_drop_user_during_session.sh` (combine `lightweight_deletes_sync` setting with time filters). Add time filters to `03723_max_insert_block_size_bytes_http.sh` which was added on master after the branch diverged. Co-Authored-By: Claude Opus 4.6 <[email protected]>
alexey-milovidov
added a commit
that referenced
this pull request
Feb 17, 2026
When there are too many modified tests, the flaky check can exceed the 2.5-hour job timeout without posting results. This passes `--global_time_limit` to `clickhouse-test`, calculated as the job timeout minus elapsed time minus a 5-minute margin. The test runner then stops gracefully before the hard timeout, allowing the CI to process and report results for completed tests. Reference: #96710 Co-Authored-By: Claude Opus 4.6 <[email protected]>
2 tasks
…rt` tests The `.sql` files were replaced by `.sh` scripts on master (with retry loops for `part_log` flushing). Accept the deletion of `.sql` files and add `event_date >= yesterday() AND event_time >= now() - 600` time filters to the new `.sh` scripts. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Fgrtue
reviewed
Feb 19, 2026
Co-authored-by: Kirill Kopnev <[email protected]>
Co-authored-by: Kirill Kopnev <[email protected]>
Co-authored-by: Kirill Kopnev <[email protected]>
…store.sh Co-authored-by: Kirill Kopnev <[email protected]>
…store.sh Co-authored-by: Kirill Kopnev <[email protected]>
Co-authored-by: Kirill Kopnev <[email protected]>
…ster Fix incomplete time filter in `01903_correct_block_size_prediction_with_default` (memory_2 CTE was missing the filter). Add `event_date >= yesterday() AND event_time >= now() - 600` to newly merged test files that query system log tables without filters. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Address review comments and fix additional missing time filters: - Add `event_date >= yesterday() AND event_time >= now() - 600` to the initial INTERSECT query in `02834_remote_session_log.sh` - Add time filters to three `session_log` queries in `02833_concurrent_sessions.sh` (HTTP, HTTP with session_id, MySQL) - Add time filters to subqueries in `02161_addressToLineWithInlines.sql` and `02796_calculate_text_stack_trace.sql` - Add time filters to polling loop queries in `02456_async_inserts_logs.sh`, `02570_fallback_from_async_insert.sh`, `02714_async_inserts_empty_data.sh`, `02725_async_insert_table_setting.sh`, `02908_many_requests_to_system_replicas.sh`, `03237_insert_sparse_columns_mem.sh`, `03338_http_compression_profile_events.sh` Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
alexey-milovidov
force-pushed
the
fix-system-log-queries
branch
from
February 28, 2026 03:42
288fd52 to
908fe29
Compare
- Fix `01275_parallel_mv` reference file to include the added time filter line - Add `finish_date >= yesterday()` to inner subquery in `01455_opentelemetry_distributed` - Mark `01903_correct_block_size_prediction_with_default` and `01526_max_untracked_memory` as `long` (they exceed 180s timeout in TSan/debug/binary flaky check) - Mark `00974_query_profiler`, `01473_event_time_microseconds`, `01569_query_profiler_big_query_id`, `02161_addressToLineWithInlines` as `no-flaky-check` (fail due to `trace_log` flush timeout or `TOO_SLOW` with randomized settings in binary flaky check) - Mark `01455_opentelemetry_distributed` as `no-flaky-check` (flaky span count in distributed query tracing) Co-Authored-By: Claude Opus 4.6 <[email protected]>
…nsitive_data_masking` as `no-flaky-check` `01903_correct_block_size_prediction_with_default` takes 600s+ in TSan even with `long` tag. `00956_sensitive_data_masking` has pre-existing flakiness at step 5b (masked string not found in server logs) unrelated to time filter changes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…flaky-check` Both tests fail in the binary flaky check due to `trace_log` flush timeout (180s server-side limit). This is a pre-existing issue unrelated to the time filter changes in this PR. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…eek_avoiding_when_reading_from_cache` as `no-flaky-check` `01360` fails due to materialized view on `query_log` capturing extra entries with randomized settings. `00180` fails with TOO_SLOW when randomized settings make the S3 INSERT too slow. Both are pre-existing flakiness issues. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The `.sql.j2` template uses `echoOn`, so the added `system flush logs query_log;` statement is echoed in the output. The reference file was missing this line. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The `SYSTEM FLUSH LOGS` statement may or may not appear in `query_log` depending on timing, causing non-deterministic test output. Filter it out in the SELECT query instead of including it in the reference file. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Apr 8, 2026
pull Bot
pushed a commit
to Dream-hu/ClickHouse
that referenced
this pull request
Sep 27, 2026
The `system.query_log` checks of `02346_text_index_partially_materialized` and `02346_text_index_optimize_trivial_count` select the `QueryFinish` row of an earlier `count()` with `event_time >= now() - 120`. `event_time` is that query's finish time and `now()` is the check's own start. Between the two the test runs another index scan and `SYSTEM FLUSH LOGS query_log`, which may block in `SystemLogQueue::waitFlush` for up to 180 s. Once the gap passes 120 s the row, which is already in the table, is filtered out: the check returns no row and its expected `1` line disappears from the output. That is the failure seen on a 346 s run: the two lines after `---- use text index reader for all parts` were missing, with nothing added. In the sibling test, `(sum on) < (sum off)` prints `0` when both rows age out, and passes without measuring anything when only the earlier `on` row does. The window was 600 s from ClickHouse#96710 until ClickHouse#111494 narrowed it to 120 s in the commit that made the test faster by shrinking its dataset, and gave the sibling the same value. Restore 600 s in all 10 predicates. 600 s is the per-test timeout (a run still alive after it is killed), so no row a run writes can fall outside the window of a check in the same run, and it is the value ClickHouse#96710 uses across the suite. Dropping the condition instead would undo ClickHouse#96710's pruning of the log scan and, in the Stress and Upgrade jobs where some workers run every test in one fixed database, remove the only bound between executions. A 126 s `sleepEachRow` inserted before the first flush reproduces the exact diff with the 120 s window (3/3) and passes with 600 s (3/3); a 30 s delay passes with 120 s. The same delay before the sibling's flush turns its check from `1` to `0` with 120 s and passes with 600 s. 50 randomized runs of each test pass, and a paired A/B at `-j 8` shows unchanged per-run time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Summary
event_date >= yesterday() AND event_time >= now() - 600filters to all SELECT queries from system log tables in stateless tests (389 files, ~680 changes)messagetomessage_format_stringinsystem.text_logWHERE clauses where the LIKE pattern matches a known format string constant from the C++ source codemax_threadsTime filter changes
All queries from the following system log tables now include time-based filtering:
query_log,text_log,trace_log,metric_log,part_log,query_thread_log,opentelemetry_span_log,zookeeper_log,transactions_info_log,error_log,blob_storage_log,backup_log,query_metric_log,query_views_log,session_log,asynchronous_insert_log,processors_profile_log,s3_queue_log,azure_queue_log,crash_log,asynchronous_metric_logmessage_format_stringconversionsWhere LIKE patterns match known C++ format string constants:
01165_lost_part_empty_partition—"Dropping table with non-zero lost_part_count equal to {}"01666_merge_tree_max_query_limit—"We have query_id removed but it's not recorded. This is a bug"02531_two_level_aggregation_bug—"Converting aggregation data to two-level."02581_share_big_sets_between_*_mutation_tasks_long—"Created Set with {} entries..."and"Got set from cache..."02935_parallel_replicas_settings—"Disabling 'use_hedged_requests'..."and"Setting 'use_hedged_requests'..."🤖 Generated with Claude Code
Version info
26.3.1.243