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: new column UUID conflicts in dual write #20460

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

eschutho
Copy link
Member

Follow up to #20351 where I added some extra checks and lookups for when a column lookup returned None on dual write. We're still seeing incidents of the same error: psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "sl_columns_uuid_key" intermittently and I was able to repro again in a test when adding in an additional query on the session for existing columns. It seems that the query is triggering an autoflush which is attempting to create a new column when one already exists. I added a no-flush flag onto any newColumn queries and also made sure to pull in the id of any existing columns when updating it and adding it to the session so that SqlAlchemy will treat it as an update instead of a write.

TESTING INSTRUCTIONS

More unit tests, because we don't have a reliable way to repro this issue. But regression testing is necessary. Most issues are happening on import when the dataset already exists and is being overwritten, but for regression, thorough testing of editing and importing datasets that either do or do not exist would be needed.

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

@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #20460 (e9e6ea6) into master (f3b289d) will decrease coverage by 0.10%.
The diff coverage is 86.95%.

❗ Current head e9e6ea6 differs from pull request most recent head 04ce15c. Consider uploading reports for the commit 04ce15c to get more accurate results

@@            Coverage Diff             @@
##           master   #20460      +/-   ##
==========================================
- Coverage   66.67%   66.56%   -0.11%     
==========================================
  Files        1739     1739              
  Lines       65111    65127      +16     
  Branches     6896     6896              
==========================================
- Hits        43414    43355      -59     
- Misses      19948    20023      +75     
  Partials     1749     1749              
Flag Coverage Δ
hive ?
mysql 82.33% <86.95%> (-0.01%) ⬇️
postgres 82.40% <86.95%> (-0.01%) ⬇️
python 82.48% <86.95%> (-0.24%) ⬇️
sqlite 82.19% <86.95%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset/connectors/sqla/models.py 89.17% <86.95%> (-0.30%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.22% <0.00%> (-15.65%) ⬇️
superset/db_engine_specs/presto.py 83.64% <0.00%> (-0.63%) ⬇️
superset/db_engine_specs/base.py 88.00% <0.00%> (-0.34%) ⬇️
superset/utils/core.py 90.03% <0.00%> (-0.12%) ⬇️

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 f3b289d...04ce15c. Read the comment docs.

@eschutho eschutho added the need:qa-review Requires QA review label Jun 21, 2022
@eschutho
Copy link
Member Author

@jinghua-qa If you're free, this could use some basic regression testing around dataset creation and importing. Thank you!

@jinghua-qa
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

@jinghua-qa Ephemeral environment spinning up at http://35.88.160.132:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@jinghua-qa
Copy link
Member

Tested regression for import and create dataset in ephermal env, LGTM!

@eschutho eschutho requested a review from hughhhh June 23, 2022 17:01
@eschutho eschutho merged commit 44f0b51 into apache:master Jun 23, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Jun 24, 2022
@sadpandajoe
Copy link
Contributor

🏷️ preset:2022.25

michael-s-molina pushed a commit that referenced this pull request Jun 28, 2022
michael-s-molina pushed a commit that referenced this pull request Jun 28, 2022
@eschutho eschutho deleted the elizabeth/fix-column-uuid branch October 21, 2022 21:00
@mistercrunch mistercrunch added 🍒 2.0.0 🍒 2.0.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.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 need:qa-review Requires QA review preset:2022.25 preset-io size/M v2.0 🍒 2.0.0 🍒 2.0.1 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants