diff --git a/RESOURCES/FEATURE_FLAGS.md b/RESOURCES/FEATURE_FLAGS.md index 7a4e32b8f2125..f7001bf7bb7f5 100644 --- a/RESOURCES/FEATURE_FLAGS.md +++ b/RESOURCES/FEATURE_FLAGS.md @@ -86,7 +86,6 @@ These features flags currently default to True and **will be removed in a future [//]: # "PLEASE KEEP THE LIST SORTED ALPHABETICALLY" - CLIENT_CACHE -- DASHBOARD_CACHE - DASHBOARD_FILTERS_EXPERIMENTAL - DASHBOARD_NATIVE_FILTERS - ENABLE_EXPLORE_JSON_CSRF_PROTECTION diff --git a/UPDATING.md b/UPDATING.md index 500841f4813e3..171edea0eaf6a 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -31,6 +31,7 @@ assists people when migrating to a new version. ### Breaking Changes +- [26349](https://github.com/apache/superset/issues/26349): Removes the deprecated `DASHBOARD_CACHE` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed. - [26369](https://github.com/apache/superset/issues/26369): Removes the Filter Sets feature including the deprecated `DASHBOARD_NATIVE_FILTERS_SET` feature flag and all related API endpoints. The feature is permanently removed as it was not being actively maintained, it was not widely used, and it was full of bugs. We also considered that if we were to provide a similar feature, it would be better to re-implement it from scratch given the amount of technical debt that the current implementation has. The previous value of the feature flag was `False` and now the feature is permanently removed. - [26343](https://github.com/apache/superset/issues/26343): Removes the deprecated `ENABLE_EXPLORE_DRAG_AND_DROP` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled. - [26331](https://github.com/apache/superset/issues/26331): Removes the deprecated `DISABLE_DATASET_SOURCE_EDIT` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed. diff --git a/superset/config.py b/superset/config.py index b664f01ea8aa9..6d473a93c4a93 100644 --- a/superset/config.py +++ b/superset/config.py @@ -433,7 +433,6 @@ class D3Format(TypedDict, total=False): "PRESTO_EXPAND_DATA": False, # Exposes API endpoint to compute thumbnails "THUMBNAILS": False, - "DASHBOARD_CACHE": False, # deprecated "REMOVE_SLICE_LEVEL_LABEL_COLORS": False, # deprecated "SHARE_QUERIES_VIA_KV_STORE": False, "TAGGING_SYSTEM": False, diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py index cf75a644fbb73..25570e91bfd96 100644 --- a/superset/dashboards/api.py +++ b/superset/dashboards/api.py @@ -83,7 +83,6 @@ from superset.models.embedded_dashboard import EmbeddedDashboard from superset.tasks.thumbnails import cache_dashboard_thumbnail from superset.tasks.utils import get_current_user -from superset.utils.cache import etag_cache from superset.utils.screenshots import DashboardScreenshot from superset.utils.urls import get_url_path from superset.views.base import generate_download_headers @@ -292,16 +291,6 @@ def __repr__(self) -> str: @expose("/", methods=("GET",)) @protect() - @etag_cache( - get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_changed_on( # pylint: disable=line-too-long,useless-suppression - id_or_slug - ), - max_age=0, - raise_for_access=lambda _self, id_or_slug: DashboardDAO.get_by_id_or_slug( - id_or_slug - ), - skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"), - ) @safe @statsd_metrics @with_dashboard @@ -349,16 +338,6 @@ def get( @expose("//datasets", methods=("GET",)) @protect() - @etag_cache( - get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_and_datasets_changed_on( # pylint: disable=line-too-long,useless-suppression - id_or_slug - ), - max_age=0, - raise_for_access=lambda _self, id_or_slug: DashboardDAO.get_by_id_or_slug( - id_or_slug - ), - skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"), - ) @safe @statsd_metrics @event_logger.log_this_with_context( @@ -419,16 +398,6 @@ def get_datasets(self, id_or_slug: str) -> Response: @expose("//charts", methods=("GET",)) @protect() - @etag_cache( - get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_and_slices_changed_on( # pylint: disable=line-too-long,useless-suppression - id_or_slug - ), - max_age=0, - raise_for_access=lambda _self, id_or_slug: DashboardDAO.get_by_id_or_slug( - id_or_slug - ), - skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"), - ) @safe @statsd_metrics @event_logger.log_this_with_context( diff --git a/superset/models/dashboard.py b/superset/models/dashboard.py index ab98b74352108..48ee403c4841a 100644 --- a/superset/models/dashboard.py +++ b/superset/models/dashboard.py @@ -20,7 +20,6 @@ import logging import uuid from collections import defaultdict -from functools import partial from typing import Any, Callable import sqlalchemy as sqla @@ -42,17 +41,11 @@ from sqlalchemy.engine.base import Connection from sqlalchemy.orm import relationship, sessionmaker, subqueryload from sqlalchemy.orm.mapper import Mapper -from sqlalchemy.orm.session import object_session from sqlalchemy.sql import join, select from sqlalchemy.sql.elements import BinaryExpression from superset import app, db, is_feature_enabled, security_manager -from superset.connectors.sqla.models import ( - BaseDatasource, - SqlaTable, - SqlMetric, - TableColumn, -) +from superset.connectors.sqla.models import BaseDatasource, SqlaTable from superset.daos.datasource import DatasourceDAO from superset.extensions import cache_manager from superset.models.helpers import AuditMixinNullable, ImportExportMixin @@ -286,11 +279,6 @@ def data(self) -> dict[str, Any]: "is_managed_externally": self.is_managed_externally, } - @cache_manager.cache.memoize( - # manage cache version manually - make_name=lambda fname: f"{fname}-v1.0", - unless=lambda: not is_feature_enabled("DASHBOARD_CACHE"), - ) def datasets_trimmed_for_slices(self) -> list[dict[str, Any]]: # Verbose but efficient database enumeration of dashboard datasources. slices_by_datasource: dict[ @@ -479,37 +467,3 @@ def id_or_slug_filter(id_or_slug: int | str) -> BinaryExpression: update_thumbnail: OnDashboardChange = lambda _, __, dash: dash.update_thumbnail() sqla.event.listen(Dashboard, "after_insert", update_thumbnail) sqla.event.listen(Dashboard, "after_update", update_thumbnail) - -if is_feature_enabled("DASHBOARD_CACHE"): - - def clear_dashboard_cache( - _mapper: Mapper, - _connection: Connection, - obj: Slice | BaseDatasource | Dashboard, - check_modified: bool = True, - ) -> None: - if check_modified and not object_session(obj).is_modified(obj): - # needed for avoiding excessive cache purging when duplicating a dashboard - return - if isinstance(obj, Dashboard): - obj.clear_cache() - elif isinstance(obj, Slice): - Dashboard.clear_cache_for_slice(slice_id=obj.id) - elif isinstance(obj, BaseDatasource): - Dashboard.clear_cache_for_datasource(datasource_id=obj.id) - elif isinstance(obj, (SqlMetric, TableColumn)): - Dashboard.clear_cache_for_datasource(datasource_id=obj.table_id) - - sqla.event.listen(Dashboard, "after_update", clear_dashboard_cache) - sqla.event.listen( - Dashboard, "after_delete", partial(clear_dashboard_cache, check_modified=False) - ) - sqla.event.listen(Slice, "after_update", clear_dashboard_cache) - sqla.event.listen(Slice, "after_delete", clear_dashboard_cache) - sqla.event.listen( - BaseDatasource, "after_update", clear_dashboard_cache, propagate=True - ) - # also clear cache on column/metric updates since updates to these will not - # trigger update events for BaseDatasource. - sqla.event.listen(SqlMetric, "after_update", clear_dashboard_cache) - sqla.event.listen(TableColumn, "after_update", clear_dashboard_cache)