Skip to content

Web UI: make the image-preview gesture discoverable in the link tooltip - #111918

Merged
alexey-milovidov merged 4 commits into
masterfrom
web-ui-image-preview-title
Jul 30, 2026
Merged

alexey-milovidov merged 4 commits into
masterfrom
web-ui-image-preview-title

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Follow-up to #109347 addressing #109347 (comment): the image preview is opt-in, so the gesture has to be discoverable. The tooltip of a previewable image link in the Web UI now says Ctrl/Cmd for preview (it used to say Ctrl+hover (Cmd+hover on Mac) to preview this image).

The regression harness (tests/integration/test_play_image_preview) pins the exact tooltip text, and now also asserts the complement: a linkified cell that does not qualify for a preview - e.g. a URL whose image extension is only in the query or the fragment - must not advertise the gesture, so the tooltip never promises a preview that will not appear.

Related: #109347

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Not needed: the feature itself is unreleased (it goes into 26.8), and the entry of #109347 already covers it.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

The `Ctrl`/`Cmd` + hover image preview is opt-in, so the only thing that
tells a user it exists is the tooltip on the link. Say it concisely:
`Ctrl/Cmd for preview`.

The harness also asserts the complement: a linkified cell that does not
qualify for a preview must not advertise the gesture, so the tooltip
never promises a preview that will not appear.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8a25d44]

Summary: ✅


AI Review

Summary

This PR shortens the Web UI image-preview tooltip in play.html and updates the regression harness to pin the new tooltip text while verifying that linkified URLs which do not qualify for preview do not advertise the gesture. I did not find a correctness, security, or regression-coverage issue in the current diff.

Final Verdict

✅ Approved

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 25, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jul 26, 2026
…tdated parts

SYSTEM RESTART REPLICA raises is_being_restarted before flushAndShutdown()
cancels the outdated-parts loading task, so an asynchronous load already in
flight observes the flag when it takes the table lock. lockForShare then threw
TABLE_IS_BEING_RESTARTED into the function-level catch of
loadOutdatedDataParts, which calls std::terminate(). The exception is not in
isRetryableException, so the retryable-error handling of this PR did not cover
it either.

Failing to take the table lock is never an inconsistent set of parts on disk,
so handle both ways it can fail and reschedule:

- The table is being restarted, dropped or detached. tryLockForShare reports
  this by returning no lock instead of throwing.
- The timed acquisition expires under contention with a writer, which throws
  DEADLOCK_AVOIDED ("Client should retry"). This is also how a restart can
  present itself, because the lock is acquired before is_being_restarted is
  checked and the restarting query holds it exclusively.

Rescheduling cannot resurrect a cancelled loader: scheduleAfter is a no-op once
the task is deactivated, and deactivate() cancels a delayed run. It matters if
the lifecycle event fails before cancelling the task, when the table stays
alive and only a retry still loads its outdated parts.

Observed on the Stress test (arm_tsan) of PR ClickHouse#110976 and the Stress test
(amd_tsan) of PR ClickHouse#111918, both aborting on table customer_dbt_materialize with
"Loading of outdated parts failed. Will terminate ... Code: 733 ...
(TABLE_IS_BEING_RESTARTED)". This is a distinct trigger from the corrupted
txn_version.txt family of ClickHouse#111053: no part transaction metadata is read on this
path.

Tests, each verified to fail on a binary with only the corresponding change
neutered:

- A restart racing the loader, choreographed with a pauseable failpoint that
  parks the loader just before it takes the lock.
- An injected lock-acquisition timeout.
- The function-level retryable catch of each loader, which nothing reached
  before: every injected error was absorbed by a worker, scheduling, cleanup or
  table-lock handler first. A failpoint in each loader body covers them.
- The retryable arm of loadUnexpectedDataPart, which drops a partially built
  part so the retry rebuilds it rather than marking a healthy part broken. The
  test requires the loader to re-enter the build path on a retry, since
  removing only the reset would otherwise still pass.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The three CI reds on 4111ce60 are all unrelated to this change (the diff is a tooltip string in programs/server/play.html plus the assertion in tests/integration/test_play_image_preview/image_preview_harness.js):

The branch has been merged with the latest master, so CI will re-run on a current base.

@groeneai, please investigate the last two failures and provide a fix in a separate PR (if a fix is already in progress, link it here):

@groeneai

Copy link
Copy Markdown
Collaborator

Both of these are known, both already have a tracking issue, and both already have a fixing PR, so no new PR is needed. Details, with the actual aborts read from the job artifacts rather than the CIDB labels.

1. Coverage Server died: multiply logical error is 03915_exchange_tables_race, tracked in #110133

clickhouse-server.err.log of that job has two aborts, both the same:

<Fatal> : Logical error: 'Arguments of 'multiply' have incorrect data types: 'n' of type 'Int256', '0.123' of type 'Float64''
(query_id: 37c38db3-...) (query: SELECT n * 0.123 FROM (SELECT * FROM tbl_03007_1)) Received signal Aborted (6)

and the log line carries (comment: .../03915_exchange_tables_race.sh-test_dj7tm2bv). So this is the EXCHANGE TABLES vs SELECT race, which is #110133 (your own issue), not an untracked failure. The root-cause fix is your #110048, merged 2026-07-26 19:23 UTC, i.e. ~22 hours after this job ran (2026-07-25 21:53 UTC), which is why the master merge you did should clear it. On the same coverage job on master, the signature fired 12 times in 520 runs between 07-21 and the merge, and I see no hit on any master commit that contains 2bf3033313d0. I also keep #109747 open as defense in depth on the same abort: ActionsDAG::evaluatePartialResult runs a dry run purely to derive a header, so a type mismatch there should be a clean exception rather than abortOnFailedAssertion, and that keeps the server up even if some other path can still produce a stale header.

One label correction while you are looking at that report: the check page attributes this to Logical error '!part.empty()'. That string is a scraper artifact. It occurs exactly once in the whole 8 MB error log, inside an SQL comment of the co-located and passing 04367_lambda_arg_backquoted_dot_no_logical_error.sql. The real abort is the multiply one quoted above.

2. Stress amd_tsan Received signal 6: loadOutdatedDataParts terminating on a retryable error, tracked in #106736, fixed by #107091

fatal.log of that job:

{BgSchPool::3a0ec2dc-...} <Fatal> test_7.customer_dbt_materialize: Loading of outdated parts failed.
Will terminate to avoid undefined behaviour due to inconsistent set of parts.
Exception: Code: 733. DB::Exception: Table test_7.customer_dbt_materialize is being restarted. (TABLE_IS_BEING_RESTARTED)
5. src/Storages/IStorage.cpp:73: DB::IStorage::lockForShare(String const&, Poco::Timespan const&)
6. src/Storages/MergeTree/MergeTreeData.cpp:3361: DB::MergeTreeData::loadOutdatedDataParts(bool)

The terminate is meant for a genuinely inconsistent on-disk set of parts, but here it fires on the table lock: stress runs SYSTEM RESTART REPLICA, which raises is_being_restarted before flushAndShutdown cancels the loading task, so an in-flight asynchronous load throws TABLE_IS_BEING_RESTARTED out of lockForShare into the function-level catch (...). That code is not in isRetryableException, so nothing catches it. Failing to take the table lock is transient and never implies a bad set of parts.

#107091 changes exactly that line to tryLockForShare and reschedules the task instead of terminating, and treats a retryable exception from the loading body the same way. It has an integration test for this precise case (SYSTEM RESTART REPLICA racing an in-flight outdated-parts load) plus one for the DEADLOCK_AVOIDED lock-timeout variant, both validated in both directions with failpoints. Tracking issue is #106736, which describes the MEMORY_LIMIT_EXCEEDED flavour of the same terminate. Over 30 days this signature has 9 hits across 8 unrelated PRs and one master run, one hit each, so it is a trunk issue and unrelated to a play.html tooltip change.

#107091 has been open since 2026-06-10 with no human review yet. It is the one that actually stops this class of server termination, so a look from @alexey-milovidov or whoever owns part loading would be welcome.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged the latest master (the branch was 339 commits behind), which pulls in #110048 and should clear the coverage Server died (multiply logical error in 03915_exchange_tables_race, #110133) that @groeneai analyzed above. The Got read request from replica ... for unknown stream abort is #110518.

Two failures on be2052789ee are still untracked, and both are trunk-wide, not caused by this play.html tooltip change:

  1. 04257_text_index_lazy_profile_events on Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) — the 6th assertion column (TextIndexLazyBlocksSkippedResolved > 0) came back 0. In the last 30 days the same test failed on Replace ExpressionAnalyzer with Analyzer for standalone expression compilation #96886, Send big list parts for distributed index analysis as scalars #110419, Fix the native Arrow reader's handling of unobservable slots, dictionaries and buffer-less lengths #110531 and Keep the stack when an async signal arrives during an MSan report #112008 as well, i.e. on unrelated PRs, and only under distributed plan / ParallelReplicas configurations — which suggests the block-level resolved-skip simply does not fire when reads are split across replicas, so the "every event must fire" assertion is not stable under those configurations.

  2. Stress amd_tsan: Logical error: 'Cannot capture column 2 because it has incompatible type: got Nullable(UInt64), but UInt64 is expected.' in ColumnFunction::appendArgument, from an AST-fuzzer query over 04490_qualified_matcher_table_alias_over_column. Same signature on 11 other PRs in 30 days (Add arrayPermutations, arrayPartialPermutations, and arrayCombinations #101135, Do not leave an orphan table when CREATE ... AS SELECT is denied #108048, Text index: introduce PForDelta compression for positions #108277, Add clickhouse-proxy application mode #110105, Read-through filesystem cache for the experimental ReaderExecutor #110029, Analyzer: exclude server-constant functions from shared function cache #107775, Use a lock-free queue for asynchronous logging #107363, Framing formats: multiplex data, totals, extremes, progress, logs, and profile events in the HTTP response stream #110127, Support output Hive text format #107582, Fix wrong result and LOGICAL_ERROR for a matcher inside a lambda with join_use_nulls / group_by_use_nulls #111993, Web UI: fix user/password field staying red with correct credentials #109414). This looks like a sixth site of the class consolidated in AST-fuzzer-internal-path: executor/planner assertions on type-invalid inputs the analyzer normally rejects (5 sites: IColumn, KeyCondition, SingleValueData, ActionsDAG ×2) #107951 (fuzzer-internal path reaching an executor assertion where a clean exception is expected).

@groeneai, please investigate these two and provide fixes in separate PRs (or link the fixes if already in progress); for (1) a tracking issue is also needed.

@groeneai

Copy link
Copy Markdown
Collaborator

Thanks - both attributions on the other reds match what I found: 03915_exchange_tables_race is the multiply logical error of #110133 (fixed by #110048), and Got read request from replica ... for unknown stream is #110518, whose fixing PR is my open #111689.

On the two you asked about:

1. 04257_text_index_lazy_profile_events

Your mechanism is right, and measurement makes it stronger and more specific than "the resolved-skip does not fire". The events do fire; they are counted on the wrong system.query_log row.

PostingListCursor::~PostingListCursor (src/Storages/MergeTree/MergeTreeIndexTextPostingListCursor.cpp:112-127) increments all six counters on whichever thread destroys the cursor, i.e. on the replica that read the granule. The test then aggregates from the initiator with current_database = currentDatabase(). I reproduced this on a local 3-replica cluster against a pristine master build (Build ID 9ebd11fe9bc8d547), projecting is_initial_query and dropping the database filter:

current_database  log_comment                  is_initial_query  seg_res  blk_res
default           04257_pe_or_seg_covered      0                 1        0
default           04257_pe_or_seg_covered      0                 2        0
...
t04257_plain      04257_pe_or_seg_covered      1                 1        0

The event-bearing rows are secondary rows, and their current_database is default, not the test's database - so the test's own filter excludes them even if it dropped the is_initial_query restriction.

Two measurements pin it:

  • With parallel_replicas_local_plan = 0 (every mark served remotely), the assertion row is 0 0 0 0 0 0 0 0 0 - all nine columns, not one.
  • With parallel_replicas_local_plan = 1, it is 1 1 1 1 1 1 1 1 1, 25/25 runs.

That also explains why the observed diffs are inconsistent, which is worth flagging because it corrects the column attribution: the three occurrences show three different shapes, not one.

occurrence observed row
#110531 (amd_asan_ubsan, distributed plan) 0 0 0 0 0 0 0 0 0
#111918 (amd_llvm_coverage, ParallelReplicas) 1 1 1 1 1 0 1 1 1 (column 6)
#112008 (same lane) 1 1 1 1 1 1 1 0 0 (columns 8, 9)

So TextIndexLazyBlocksSkippedResolved is column 6 as you say for the failure on this PR, but the failure on #112008 lost columns 8 and 9 (LeapfrogIntersections, AdvanceCount) and #110531 lost all nine.

The per-column shape follows from the contribution table, measured per tagged query:

log_comment                c1  c2  c3  c4  c5  c6  c7  c8  c9
04257_pe_alg_leapfrog      12   6   6   0   0   0   0   1   5
04257_pe_or_seg_covered     0   9   9   9   1   0   0   0   0
04257_pe_or_block_covered   3   2   2   1   0   1   0   0   0
...

Columns 5, 6, 8 and 9 each have exactly one contributing query, so if that single query's granule happens to be served by a remote replica, that column alone reads 0. Columns 1-4 and 7 have several contributors, so they survive unless every query goes remote. The table is one granule (index_granularity = 8192 over 2000 rows), so each tagged query's single mark is assigned to exactly one replica - which is where the randomness comes from.

The frequency matches a per-mark assignment race rather than a deterministic mode: over 45 days the two affected lanes are distributed plan 3 bad / 6049 OK and ParallelReplicas 2 bad / 11159 OK, with 0 failures on master, on any release branch, or on any of the ~20 other stateless lanes. parallel_replicas_local_plan is randomized 0/1 at tests/clickhouse-test:1548, so roughly half of the runs on those lanes are in the exposed regime and a minority of those lose a column.

The fix is a one-line pin in the test. SET enable_parallel_replicas = 0 at the top, measured on the same cluster:

  • forced parallel_replicas_local_plan = 0, no pin: 0 0 0 0 0 0 0 0 0
  • forced parallel_replicas_local_plan = 0, with pin: 1 1 1 1 1 1 1 1 1

The statement-level SET wins over the lane's users.d/enable_parallel_replicas.xml profile, so the pin holds on exactly the lanes that fail. This keeps every assertion intact rather than weakening the "every event must fire" contract, which I would rather not relax - the counters are the only thing standing between a silently disabled skip optimisation and a green test. I will send that as its own PR and post the link here.

One note on the tracking issue: I am not able to open GitHub issues on my own initiative. If you would like it filed, say so and I will open it immediately with the above as the description; otherwise the PR will carry the analysis.

2. Cannot capture column 2 ... got Nullable(UInt64), but UInt64 is expected

This one already has a fix in progress: #111993 (Fix wrong result and LOGICAL_ERROR for a matcher inside a lambda with join_use_nulls / group_by_use_nulls), open, mine.

I confirmed it covers this signature rather than assuming it, by running the family shapes against the pristine master build and against #111993's own prebuilt debug binary:

shape master #111993
arrayMap(b -> sipHash64(b.*), [1]) ... LEFT JOIN ... ON ... SETTINGS join_use_nulls = 1 abort, Cannot capture column 2 ... got Nullable(UInt64), but UInt64 is expected. OK
same with FULL JOIN abort, identical message OK
same with INNER JOIN OK OK

Byte-identical message to the one on this PR, and the frames match (ColumnFunction.cpp:383 appendArgument under ExecutableFunctionCapture::executeImpl from ActionsDAG::updateHeader).

Your list of 11 other PRs matches mine except that the signature splits by architecture: over 30 days the phrase spans exactly two STIDs, 3293-4e7f (6 hits, all arm) and 3293-46fa (6 hits, all amd) - same defect, the two arches inline differently. 12 hits, 12 distinct PRs, 0 master or release-branch rows, first seen 2026-07-14.

Two corrections to the classification, both of which reduce the scope of what is owed:

So no separate PR is owed for (2). #111993 has finished CI and is waiting for review; I will not need to touch it for this.

@groeneai

Copy link
Copy Markdown
Collaborator

Fixing PR for 04257_text_index_lazy_profile_events (and its sibling 04258_text_index_lazy_intersect_heap): #112263

Your hypothesis was right in mechanism and the root cause turned out to be slightly more specific than "the resolved-skip does not fire": the events do fire, but they are counted on the replica that reads the granule, and remote ProfileEvents are never merged into the initiator's system.query_log row. They land on secondary rows whose current_database is not the test database, so the assertions' current_database = currentDatabase() predicate excluded exactly the rows that own the counters.

Two corrections to my earlier comment, both in the PR description:

A tracking issue is still needed and I do not open issues on my own initiative, so that offer stands: say the word and I will file it with the analysis above.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Thanks, both are covered:

CI has since re-run on the merged base and both of those are gone. The only remaining red on this PR is Stress test (arm_asan_ubsan, s3): the toStartOfInterval signed integer overflow at src/Functions/toStartOfInterval.cpp:293, which is fixed by my open #112045 and is unrelated to a play.html tooltip string.

@groeneai

Copy link
Copy Markdown
Collaborator

Tracking issue filed: #112377

Two things came out wider than the analysis I posted here, so the issue is not scoped to the text index:

  • The gap is not parallel-replica-specific. Plain remote() shows it too, and the initiator row is not
    cleanly "local work only": SelectedRows is on it with the correct total while SelectedMarks /
    SelectedRanges / SelectedParts are 0. Those two events survive only because they ride on the
    Progress packets, which RemoteSource.cpp:42 turns into a local ISource::progress call that
    re-increments them at ReadProgressCallback.cpp:116-117. Every other event goes into the internal
    profile-events queue, whose only drain is client transmission. So which events survive is decided by
    the transport they happen to travel on.
  • Aggregating over initial_query_id, which is what Fix flaky 04257/04258 text-index ProfileEvents assertions under parallel replicas #112263 does, is right for the sum(...) > 0
    assertions but is not a general workaround. On a read whose true value is 20000 rows / 2 marks / 1
    part it returns 40000 / 6 / 3: SelectedRows doubles because it is on the initiator row as well, and
    the mark and part counts multiply by the replica count because each replica analyses the whole part
    and reports the analysis, then reads only its assigned marks. Confirmed against replica count (2
    replicas gives 4 marks, 3 gives 6, while SelectedRows stays 40000). So no single aggregation is
    correct across event classes, and nothing in the row tells a caller which class an event is in. That
    is the part in the issue rather than in the PR.

I could not apply labels to the issue myself.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Jul 30, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 30, 2026
Merged via the queue into master with commit 2ac3bc8 Jul 30, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the web-ui-image-preview-title branch July 30, 2026 21:35
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants