Fix queries with same query_id on different hosts being deduplicated#240
Merged
Fix queries with same query_id on different hosts being deduplicated#240
Conversation
HashMap was keyed by query_id alone, so cluster queries with the same query_id on multiple hosts (e.g. ON CLUSTER DDL) would overwrite each other. Use (query_id, host_name) composite key instead. Though note that i.e. logs/traces/perfetto will show data for all queries with the same query_id. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
queries_count_subqueries and queries_sum_profile_events were keyed by initial_query_id alone. When the same initial_query_id existed on multiple cluster hosts, subquery counts were summed across hosts and profile events were merged, making cpu/io_wait/cpu_wait identical for all hosts. Key by (initial_query_id, host_name) instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The query_id_to_host map was 1:1, so when the same query_id appeared on multiple cluster hosts only the last-seen host survived. All per-server Perfetto tracks (counters, spans, logs, stack traces, etc.) were then attributed to the wrong host. Add hostName() to all Perfetto data source SQL queries so each row carries its actual origin host, and pass it directly to get_host_category_track instead of the lossy query_id lookup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
selected_query_ids was HashSet<String> (query_id only), so selecting a query with a duplicate query_id on another host would select both. This also caused the profile events diff view to include wrong queries. Change to HashSet<QueryKey> ((query_id, host_name)) so selection, diff view, and query_id collection for flamegraphs/logs/perfetto all respect the host boundary. Stop mutating host_name for display stripping — use a separate display_host_name field instead, so query_key() always returns the original hostname and selection/lookup works correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
No description provided.