mikebridge commented on PR #44835: URL: https://github.com/apache/superset/pull/44835#issuecomment-5942859361
Carrying over a question @rusackas asked on the superseded #44808, since this is the layer that answers it: > if Sync metadata can change a metric definition without bumping the semantic-view row, a chart's query cache could keep serving the pre-sync result until TTL expires, which seems to undercut the point of a manual sync button. That's handled in this PR for layers that opt in to metadata refresh. `SemanticView.get_extra_cache_keys` (`superset/semantic_layers/models.py:720`) adds the view's metadata cache token to every chart-result cache key, and that token is derived from the catalog snapshot the query actually used. A successful refresh publishes a new snapshot, so the token changes and the pre-sync result can no longer be looked up; no row on the semantic view needs to change. `test_same_name_and_discovery_after_refresh_cannot_reuse_old_query_result` in `tests/unit_tests/semantic_layers/metadata_identity_test.py` exercises exactly this through the real data cache. Two limits worth stating: - It applies only to participating layers (provider opted in and `SEMANTIC_LAYER_METADATA_REFRESH_ENABLED` on). Layers that don't participate keep today's TTL behaviour. - @sadpandajoe's open thread here about `annotation_data` cached by a SQL-backed chart from a semantic-view chart is a related case this token doesn't cover yet; that one is being worked on. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
