Skip to content
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: catch some potential errors on dual write #20351

Merged
merged 2 commits into from Jun 14, 2022

Conversation

eschutho
Copy link
Member

we're seeing some errors when trying to import a dashboard: psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "sl_columns_uuid_key" The issue is intermittent, and I was only able to replicate in a test by making the lookup for a NewColumn return none. I added in a catch for that scenario and also changed the session add to merge to take a safer route in case SqlAlchemy is trying to add rather than update in some cases.

TESTING INSTRUCTIONS

difficult to reproduce, but regression testing should apply: you should be able to update datasets, columns, etc with no errors.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

items = set(session)
except ObjectDeletedError:
logger.warning("ObjectDeletedError", exc_info=True)
return iter(())
Copy link
Member Author

@eschutho eschutho Jun 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was erroring for me when running integration tests, so I just thought it would be safe to catch and log the error in case it happens in the real world.

@codecov
Copy link

codecov bot commented Jun 11, 2022

Codecov Report

Merging #20351 (0c6c94f) into master (eab0009) will increase coverage by 0.02%.
The diff coverage is 69.88%.

❗ Current head 0c6c94f differs from pull request most recent head 4efb13a. Consider uploading reports for the commit 4efb13a to get more accurate results

@@            Coverage Diff             @@
##           master   #20351      +/-   ##
==========================================
+ Coverage   66.49%   66.51%   +0.02%     
==========================================
  Files        1734     1738       +4     
  Lines       64996    65097     +101     
  Branches     6871     6885      +14     
==========================================
+ Hits        43219    43302      +83     
- Misses      20020    20047      +27     
+ Partials     1757     1748       -9     
Flag Coverage Δ
hive 53.70% <48.14%> (?)
mysql ?
postgres ?
presto 53.56% <48.14%> (-0.01%) ⬇️
python 82.45% <88.88%> (-0.12%) ⬇️
sqlite 82.09% <88.88%> (+<0.01%) ⬆️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ages/superset-ui-core/src/query/types/Dashboard.ts 100.00% <ø> (ø)
...packages/superset-ui-core/src/query/types/Query.ts 100.00% <ø> (ø)
.../legacy-plugin-chart-world-map/src/controlPanel.ts 25.00% <0.00%> (-8.34%) ⬇️
...s/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts 14.28% <0.00%> (-2.39%) ⬇️
...gacy-preset-chart-nvd3/src/DistBar/controlPanel.ts 8.33% <0.00%> (-2.78%) ⬇️
.../legacy-preset-chart-nvd3/src/Line/controlPanel.ts 50.00% <0.00%> (-50.00%) ⬇️
...s/plugin-chart-echarts/src/BoxPlot/controlPanel.ts 25.00% <0.00%> (-75.00%) ⬇️
...s/plugin-chart-echarts/src/Funnel/controlPanel.tsx 66.66% <0.00%> (-13.34%) ⬇️
...ns/plugin-chart-echarts/src/Gauge/controlPanel.tsx 66.66% <0.00%> (-33.34%) ⬇️
...ns/plugin-chart-echarts/src/Graph/controlPanel.tsx 21.42% <0.00%> (-1.65%) ⬇️
... and 77 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eab0009...4efb13a. Read the comment docs.

@eschutho eschutho merged commit 5a13782 into apache:master Jun 14, 2022
@eschutho eschutho deleted the elizabeth/fix-update-bug branch June 14, 2022 00:30
@sadpandajoe
Copy link
Contributor

🏷️ preset:2022.23

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Jun 14, 2022
* catch some potential errors on dual write

* fix test for sqlite

(cherry picked from commit 5a13782)
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Jun 14, 2022
* catch some potential errors on dual write

* fix test for sqlite

(cherry picked from commit 5a13782)
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset:2022.23 preset-io size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants