-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SIP-93] Proposal for non-blocking SQL Lab persistence #21385
Comments
I like this idea. Can you elaborate more on which states will be pulled to local storage and which states will be kept exclusively on remote? I'd imagine we probably shouldn't keep even a temporary local copy of big payloads such as query results. For states that can be loaded fresh upon page load--such as There are also some duplicates in saved states, too, that we may want to clean up: I also noticed we are saving previous queries of current active tab even though they may never be used again. Should be able to save a lot of space if we just clean them up. To summarize, I think it'd be useful to start cleaning up current saved states when |
Good point. There's a helper function for this and planning to reuse this function to trim the unnecessary items. superset/superset-frontend/src/SqlLab/utils/reduxStateToLocalStorageHelper.js Lines 56 to 60 in 5f9f657
agree. I want to remove the current local storage copy of query results (The query results will retain while tab is opened)
yes. It will trim the unnecessary saved states during this job. |
Interesting idea @justinpark . I wonder if we should provide both sync and async persistence options or just provide the async version as the evolution of the feature. If it's the latter, we could reuse the same feature flag given that we're planning to clean up the current state, which will modify the existing feature anyway. |
Nice proposal @justinpark |
Took a look today, this is comprehensive, seems reasonable and I don't think there's anything controversial here. +1 Though I'd love to get @betodealmeida 's blessing since I believe he implemented the original |
@michael-s-molina |
Closing the SIP as it was approved. |
[SIP-93] Proposal for async SQL Lab persistence
Motivation
At Airbnb we have a performance (lag) issue using
SQLLAB_BACKEND_PERSISTENCE
feature.Since
SQLLAB_BACKEND_PERSISTENCE
designed in a blocking way (as shown in the following), user can be stuck whiletab_state
table in busy state. (even unable to run a query while thetabstateview
endpoint timed out)superset/superset-frontend/src/SqlLab/actions/sqlLab.js
Lines 614 to 625 in 8c2719b
In order to improve this lag issue, we'd like to have a non-blocking mechanism for this db syncing workflow. i.e. like g-doc auto saving. moreover we'd like to design a hybrid solution (i.e. keep using redux-localstorage and save same snaphot in remote) to keep the advantage (offline saving) of using local storage.
Proposed Change
The proposed solution is simple. We would like to keep using redux-localstorage as well as the current localStorage mechanism (as SQLLAB_BACKEND_PERSISTENCE turned OFF). Like QueryAutoSync does, we would like to build a component that observes the changes of queryEditor and then periodically sync the updated queryEditor snapshot from redux state using existing
/tabstateview/
api.For the payload wise, we'd like to use
extra_json
intab_state
table to store the snapshot(by json format) of queryEditor as stored in localStorage (rather than mapping each value in a proper table column like sql, label, query_limit).As existing persistence feature does, we will design similar hydration flow in frontend to initialize the sqlLab state from the backend. With this json blob it will simply convert to json and then merge with the existing local state.
New or Changed Public Interfaces
We will replace prefetch(
/tabstateview/
call) block code in sqllab actions on SQLLAB_BACKEND_PERSISTENCE (or introduce new) and need to pass theSQLLAB_BACKEND_PERSISTENCE_ASYNC
FLAG if preferredactive_tab
value includingextra_json
in this case.New dependencies
I do not for-see any new dependencies.
Migration Plan and Compatibility
I do not for-see any migration required.
Rejected Alternatives
None.
to: @etr2460 @ktmud @john-bodley
cc: @betodealmeida
The text was updated successfully, but these errors were encountered: