-
Notifications
You must be signed in to change notification settings - Fork 14k
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
feat(sqllab): non-blocking persistence mode #24539
feat(sqllab): non-blocking persistence mode #24539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @justinpark. I left some first-pass comments.
superset-frontend/src/SqlLab/components/EditorAutoSync/index.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/SqlLab/components/EditorAutoSync/index.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/SqlLab/components/EditorAutoSync/EditorAutoSync.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/SqlLab/components/EditorAutoSync/EditorAutoSync.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/SqlLab/components/EditorAutoSync/EditorAutoSync.test.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/SqlLab/components/EditorAutoSync/EditorAutoSync.test.tsx
Outdated
Show resolved
Hide resolved
@sadpandajoe @jinghua-qa could you help test the feature? |
@michael-s-molina sure, if you want to spin up the ephemeral for me. I've noticed some issues already where results aren't always showing up so i want to make sure it's not an issue between OSS and Preset |
/testenv up FEATURE_SQLLAB_BACKEND_PERSISTENCE=true |
@michael-s-molina Ephemeral environment spinning up at http://54.203.45.163:8080. Credentials are |
@justinpark looks like column auto-complete isn't working in this branch Screen.Recording.2023-07-12.at.1.13.02.PM.mov |
Table schemas get removed when switching between tabs
what happens? Screen.Recording.2023-07-12.at.1.29.14.PM.mov |
User is not able to remove schemas without an error warning
What happens? |
@justinpark is anything cached? I noticed that for columns it didn't show up the first time and then for another schema it works |
Results are not always shown with sql lab query. This is pretty hard to reproduce but also seem to be hitting a performance limit
Around tab 6 i'm starting to see performance issues with that tab loading. You can also see at the end of the video that although there is data, it won't return any results. Screen.Recording.2023-07-12.at.4.04.09.PM.mov |
9a696b1
to
7cb44c9
Compare
@sadpandajoe Thanks for testing. The missing columns on autocomplete has been fixed from #24611 and I also rebased this branch to include the fix. |
Codecov Report
@@ Coverage Diff @@
## master #24539 +/- ##
==========================================
- Coverage 69.03% 68.97% -0.06%
==========================================
Files 1908 1903 -5
Lines 74197 74034 -163
Branches 8186 8190 +4
==========================================
- Hits 51219 51068 -151
+ Misses 20857 20845 -12
Partials 2121 2121
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@justinpark @michael-s-molina do we need to spin up a new ephemeral for the changes? |
/testenv up FEATURE_SQLLAB_BACKEND_PERSISTENCE=true |
@justinpark Ephemeral environment creation is currently limited to committers. |
@michael-s-molina could you help to boot up testenv? |
/testenv up FEATURE_SQLLAB_BACKEND_PERSISTENCE=true |
@michael-s-molina Ephemeral environment spinning up at http://18.236.148.224:8080. Credentials are |
does ephemeral logins work for either of you @michael-s-molina / @justinpark? I haven't been testing since I can't log in. |
@sadpandajoe same problem. @michael-s-molina have you faced same problem? |
3b9091b
to
b240338
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ephemeral environment shutdown and build artifacts deleted. |
Co-authored-by: Justin Park <justinpark@apache.org>
Co-authored-by: Justin Park <justinpark@apache.org>
Co-authored-by: Justin Park <justinpark@apache.org>
Co-authored-by: Justin Park <justinpark@apache.org>
SUMMARY
Following up SIP-93, this commit implements the first step of non-blocking persistence mode for the current working sqllab editor activities.
As described in SIP-93, the existing PERSISTENCE logic causes a user interaction delay due to the network (or server side) lagging. For example, user had to wait the server response in order to update the tab name or query limit count. (see the before screenshot)
Therefore, this commit aims to improve current tab activities by replacing the following blocking logics with a non-blocking way by cumulating the changes and syncing them with the latest updates asynchronously:
Mechanism for syncing unsaved changes
There can be unsaved changes since it is syncing in a non-blocking way and asynchronously. To address this issue, unsaved changes will be stored in local storage (using localStorage in persistence mode) until they are successfully saved on the server. This hybrid approach ensures that user data is not lost and that any unsaved changes are retrieved, even in the event of an unexpected interruption.
Resolve conflicts
When a user opens multiple windows, they may be overwritten by the inactive editor tab state. To prevent this unexpected overwrite, the latest update time will be compared with the local cache state, and the out-of-updated state will be discarded. This ensures that users can work on multiple windows without losing their progress or having their work overwritten.
Following up
Creating new tabs and removing tabs are still blocking way in this commit but will be migrated into the non-blocking way in future PRs. Additionally, the existing migrateQueryEditorFromLocalStorage logic will be consolidated or replaced by the AutoSync with mutation APIs in the upcoming PRs. These changes will further improve the user experience by making the entire process non-blocking and asynchronous.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After:
after--nonblocking.mov
Before:
before--nonblocking.mov
TESTING INSTRUCTIONS
Set SQLLAB_BACKEND_PERSISTENCE true and play with the SQL Lab editor and keep hard refresh to verify the persisted states.
ADDITIONAL INFORMATION
SQLLAB_BACKEND_PERSISTENCE