Repository navigation
feat(semantic): add metadata sync and cache inspection UI - #44851
mikebridge wants to merge 132 commits into
Conversation
Signed-off-by: Mike Bridge <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #44851 +/- ##
==========================================
+ Coverage 82.59% 82.75% +0.16%
==========================================
Files 3005 3019 +14
Lines 186941 188529 +1588
Branches 43308 43575 +267
==========================================
+ Hits 154399 156013 +1614
+ Misses 29778 29736 -42
- Partials 2764 2780 +16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…7-metadata-refresh-ui
…7-metadata-refresh-api
…7-metadata-refresh-ui
| @@ -188,15 +218,102 @@ export default function SemanticViewEditModal({ | |||
| }); | |||
| addSuccessToast?.(t('Semantic view updated')); | |||
| onSave(); | |||
There was a problem hiding this comment.
A slow Save can overwrite a newer sync here. Closing the modal resets busy, so the editor can be reopened and Sync metadata completed while the PUT is still pending. When the PUT then resolves, this unguarded onSave() runs the handleDatasourceSave(datasource) captured at click time and restores the pre-sync datasource and controls in Explore. Should onSave() be skipped (or re-read the current datasource) when isCurrent() is false?
There was a problem hiding this comment.
Confirmed. UI commit 6d61811a40 guards onSave with the same operation generation as modal closure, so an old PUT can still report its outcome without replaying a stale Explore datasource callback. The regression starts Save, closes/reopens, completes a newer sync, then resolves Save and verifies no stale callback or modal close and the refreshed structure remains. One side effect: a Save that finishes after the editor has closed no longer refreshes the dataset list, so the list may need a manual reload in that case.
| # Later execution retains this view without renewing its budget. | ||
| _captured: str | None = source.metadata_cache_token | ||
| except (SupersetException, MetadataRefreshError) as ex: | ||
| raise QueryObjectValidationError(error_msg_from_exception(ex)) from ex |
There was a problem hiding this comment.
A MetadataRefreshError raised while preparing a semantic-view annotation is converted to QueryObjectValidationError here, so chart-data returns a validation-style 400 with no category. For example, with metadata storage unavailable the client gets a 400 instead of the 503 unavailable / 502 / 504 mapping that semantic-metadata-operations.md says applies to chart-data requests, so retry handling keyed on the status code won't fire. Should this re-raise the typed error, or should the doc call out this exception?
There was a problem hiding this comment.
Confirmed and repaired in owning store commit 34f90b5244, merged into local UI 6d61811a40. Typed metadata errors escape annotation validation conversion and reach the API's existing GET/POST mapper. Processor-plus-adapter regressions demonstrate503/504/502 instead of400, while existing route mapping tests pass; no new live annotation HTTP run is claimed.
| if not participates(layer): | ||
| raise MetadataRefreshError("configuration_changed") | ||
| if db.session.new or db.session.dirty or db.session.deleted: | ||
| _revalidation_unavailable("pending ORM changes") |
There was a problem hiding this comment.
A cold async chart query can fail here with unavailable even though PostgreSQL, Redis and the provider are healthy. _execute_task_body commits the PENDING→IN_PROGRESS transition and then assigns task.status = IN_PROGRESS on the expired Task row in the same db.session (scheduler.py:562), so that instance is dirty (or, after the next autoflush, has an assigned transaction ID). When execute_chart_query then needs to publish a catalog because the snapshot expired or was invalidated while the task was queued, before_publish runs this check and reaches _revalidation_unavailable, while warm-catalog reads skip it. The worker test calls .func directly, so it never goes through that bookkeeping. Is the caller-transaction check meant to apply to the GTF task row, or should the worker revalidate through its own connection?
| onSave(); | ||
| onHide(); | ||
| if (isCurrent()) { | ||
| onSave(); |
There was a problem hiding this comment.
Closing the editor mid-Save with no sync now skips onSave, so DatasetList shows the old description after the success toast; master refreshes it. Skipping only when a sync completed after Save started keeps the race fix. No suggestion: it needs a ref set in handleSync too.
|
This stack is being replaced by #45100 (configuration Save bumps a per-layer cache version; no coordinated refresh machinery). Context in #44835 (comment). |
|
Closing as superseded by #45100, which narrows SC-121047's refresh work to the configuration-edit workflow: saving a semantic layer bumps a per-layer cache version, plus a small Reload metadata action for upstream-only changes, with no coordinated refresh/store machinery. See the context in #44835 (comment). Thanks to everyone who reviewed this stack; several of the lessons and tests carried over. |
Why
When someone adds or changes a metric or dimension in their semantic layer (for example in dbt/MetricFlow), Superset keeps using what it has cached:
Today the only way to see the change is to wait for those caches to expire. This stack lets an authorized user clear the semantic-layer caches on demand, with a "Sync metadata" button in the semantic view editor. The new definitions show up right away, and results cached under the old definitions are never served afterwards.
It's split into four PRs so each can be reviewed on its own. Everything is default-off.
SUMMARY
Fourth and last PR in the stack replacing #44808 (semantic-view metadata refresh). Stacked on #44849 → #44835 → #44834; please review only the UI layer's changes. It's default-off.
It adds the user-facing pieces on top of the authorized maintenance operations:
The button is the first caller of a UI-independent operation; other entry points can use the same API later.
The Cache metadata tab is a default-off diagnostic. Browser and live-provider acceptance are still pending.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
Includes the one-line CodeQL
initv4.38.2 pin (identical to Dependabot #44860) to unbreak the Analyze checks after master bumpedanalyze. It disappears once #44860 merges.Stacked on the three PRs above; browser and live-provider acceptance are still pending.