Skip to content

Commit 35fa4ed

Browse files
committed
fix(sql): show bridge badge for Iceberg-tiered topics before sync [UX-1330]
The SQL editor's "Bridge query" badge was gated on the presence of an Iceberg lag metric series rather than on whether the queried topic is actually Iceberg-tiered. A freshly-tiered topic that hasn't started translating yet emits no `iceberg_topic_translation_lag` / `iceberg_topic_commit_lag` series, so `bridge` resolved to undefined and the query — every row served from the topic tail — looked like a plain query. Classify bridge-ness from the authoritative `redpanda.iceberg.mode` config (via useTopicIcebergQuery, already used by the catalog tree), independent of lag-metric availability. Lag values default to 0 when their series is absent; the lag timeline stays hidden until real lag appears, but the badge now shows for any tiered topic.
1 parent c67053c commit 35fa4ed

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

frontend/src/components/pages/sql/sql-workspace.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
useInvalidateSqlCatalog,
3434
useListCatalogsQuery,
3535
useListTablesQuery,
36+
useTopicIcebergQuery,
3637
} from 'react-query/api/sql';
3738
import { useLegacyListTopicsQuery } from 'react-query/api/topic';
3839
import { toast } from 'sonner';
@@ -405,9 +406,17 @@ export function SqlWorkspace({ sqlRole: sqlRoleProp }: SqlWorkspaceProps) {
405406
}));
406407
}, [catalogsData]);
407408

409+
// Whether the queried topic is Iceberg-tiered — the authoritative bridge-query
410+
// signal (`redpanda.iceberg.mode`), independent of any lag metric. A topic that
411+
// is tiered but hasn't started translating yet emits no lag series, so the badge
412+
// must key off the config, not metric presence (else a not-yet-synced bridge
413+
// query — every row served from the topic — would look like a plain query).
414+
const { isIceberg: bridgeTopicTiered } = useTopicIcebergQuery(bridgeTopic ?? '', {
415+
enabled: Boolean(bridgeTopic),
416+
});
408417
// Bridge-query lag for the queried topic, read from the ObservabilityService
409-
// (per-topic named queries) — decoupled from ExecuteQuery. A non-Iceberg topic
410-
// has no pending-lag series, so `bridge` resolves to undefined and nothing shows.
418+
// (per-topic named queries) — decoupled from ExecuteQuery. Drives only the lag
419+
// timeline; the badge itself comes from `bridgeTopicTiered` above.
411420
const bridgeTxLag = useExecuteInstantQuery(
412421
{
413422
queryName: 'iceberg_topic_translation_lag',
@@ -429,18 +438,18 @@ export function SqlWorkspace({ sqlRole: sqlRoleProp }: SqlWorkspaceProps) {
429438
{ enabled: Boolean(bridgeTopic) }
430439
);
431440
const bridge = useMemo<BridgeInfo | undefined>(() => {
432-
if (!bridgeTopic) {
441+
// Bridge-ness is the topic being Iceberg-tiered — not whether lag has shown up.
442+
// Lag defaults to 0 when its series is absent (e.g. translation hasn't started),
443+
// which the timeline reads as "fully caught up" and hides; the badge still shows.
444+
if (!(bridgeTopic && bridgeTopicTiered)) {
433445
return;
434446
}
435447
const tx = bridgeTxLag.data?.results?.[0]?.value?.value;
436448
const commit = bridgeCommitLag.data?.results?.[0]?.value?.value;
437-
if (tx === undefined && commit === undefined) {
438-
return;
439-
}
440449
const translationLag = tx ?? 0;
441450
const commitLag = commit ?? 0;
442451
return { topic: bridgeTopic, translationLag, commitLag, totalLag: translationLag + commitLag };
443-
}, [bridgeTopic, bridgeTxLag.data, bridgeCommitLag.data]);
452+
}, [bridgeTopic, bridgeTopicTiered, bridgeTxLag.data, bridgeCommitLag.data]);
444453

445454
// Redpanda-catalog tables, fetched up front so both the add-topic wizard and
446455
// editor autocomplete (and the bridge indicator below) can resolve table refs.

0 commit comments

Comments
 (0)