-
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
fix: Remove positions from json_metadata #17766
fix: Remove positions from json_metadata #17766
Conversation
Confirmation that the issue is resolved will be very much appreciated. CC @serenajiang @etr2460 @graceguo-supercat |
superset/dashboards/dao.py
Outdated
@@ -238,6 +238,8 @@ def set_dash_metadata( # pylint: disable=too-many-locals | |||
if int(key) in slice_ids | |||
} | |||
md["default_filters"] = json.dumps(applicable_filters) | |||
# positions have its own column, no need to store it in metadata | |||
md.pop("positions", None) |
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.
Maybe we should do a migration that removes positions
from metadata instead of popping it in dao?
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.
positions
still need to be passed to the set_dash_metadata
function as certain logics are happening here that use it. What it does not need is to be stored as its own object in the metadata, that's why it's now being popped out from the metadata object.
In general, the set_dash_metadata
function has some pretty mixed logic and it would require a bigger refactor. Things like the title, the css, and other data that is unrelated to the dashboard metadata is being used here when it shouldn't. Let's plan for a full refactor. CC @rusackas
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 clarification!
superset-frontend/src/dashboard/components/PropertiesModal/index.tsx
Outdated
Show resolved
Hide resolved
…ex.tsx Co-authored-by: Kamil Gabryjelski <[email protected]>
….com/geido/incubator-superset into fix/remove_positions_in_jsonmetadata
|
||
// temporary fix to remove positions from dashboards' metadata | ||
if (metadata?.positions) { | ||
delete metadata.positions; |
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.
This is to ensure that dashboards that are being affected by an excessively large positions object
can work properly. This check can be likely removed in the near future.
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.
sorry, why would we be able to remove this in the future? or actually, why do we need this at all if we're removing the attribute in the backend below?
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.
@etr2460 all the dashboards that have been saved after the changes were introduced have the positions
object appearing in their metadata inside the properties modal. I could not reproduce the error in the first place, so I wasn't sure whether that might also cause any problem. This just ensures it won't ever appear in the metadata to the user. I think it can be removed in the future assuming most dashboards will be then be updated and their positions
object removed by the backend when saved.
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.
i see, so this is an attempt to fix up the potentially broken json_metadata. makes sense, thanks!
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.
Code looks good to me, tested and everything works as before (which is good). Let's wait for confirmation that it solves the issue since I couldn't reproduce it.
/testenv up |
spinning up a testenv here to both try and repro the bug and to see if this resolves the issue we were seeing with doubling the position json in the database |
@etr2460 Ephemeral environment spinning up at http://34.215.104.58:8080. Credentials are |
Confirmed fix 🥳 |
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 testing @serenajiang. let's ship it!
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.
Code looks fine to me, and tested empirically - I wasn't able to break anything! 🥳
Ephemeral environment shutdown and build artifacts deleted. |
* Remove positions from json_metadata * Update superset-frontend/src/dashboard/components/PropertiesModal/index.tsx Co-authored-by: Kamil Gabryjelski <[email protected]> * Indent Co-authored-by: Kamil Gabryjelski <[email protected]> (cherry picked from commit 274fb37)
* Remove positions from json_metadata * Update superset-frontend/src/dashboard/components/PropertiesModal/index.tsx Co-authored-by: Kamil Gabryjelski <[email protected]> * Indent Co-authored-by: Kamil Gabryjelski <[email protected]>
* Remove positions from json_metadata * Update superset-frontend/src/dashboard/components/PropertiesModal/index.tsx Co-authored-by: Kamil Gabryjelski <[email protected]> * Indent Co-authored-by: Kamil Gabryjelski <[email protected]>
SUMMARY
This PR is a follow-up of PR #17570 in response to the issue that was brought in revert-PR #17753.
The changes in PR #17570 saved the
positions
in thejson_metadata
of a Dashboard even if that wasn't really necessary. It appears that very large dashboards might encounter an error as thepositions
might become too large AND/OR non-ascii characters might cause the json parsing to fail.This PR forcefully removes the
positions
from the metadata, while making sure that all the related logics remain in place. It also introduces a temporary fix to make sure that Dashboards currently affected by this issue should ignore thepositions
in their metadata entirely.TESTING INSTRUCTIONS
ADDITIONAL INFORMATION