Skip to content

fix(permalink): backport shared lock on concurrent permalink re-read to 6.2 (#45102) - #45152

Closed
luizotavio32 wants to merge 1 commit into
apache:6.2from
luizotavio32:fix/backport-45102-permalink-shared-lock-6.2
Closed

luizotavio32 wants to merge 1 commit into
apache:6.2from
luizotavio32:fix/backport-45102-permalink-shared-lock-6.2

Conversation

@luizotavio32

Copy link
Copy Markdown
Contributor

SUMMARY

Backport of #45102 to 6.2.

On 6.2, bursts of 3 or more identical permalink requests for the same dashboard can still return 500 on MySQL. Each request that loses the race re-reads the winner's row with an exclusive lock while already holding a shared lock on it, so the losers wait on each other and MySQL aborts one with a deadlock. This backport makes that re-read take a shared lock instead.

The distributed-lock release and report-config changes from the original PR are left out, since that code doesn't exist on 6.2.

TESTING INSTRUCTIONS

Unit tests from the original PR are included.

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

🤖 Generated with Claude Code

…ted permalink (apache#45102)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit cb8ff28)
Comment on lines +128 to +130
entry = KeyValueDAO.get_entry(
self.resource, uuid_key, lock=RowLock(read=True)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: With PostgreSQL REPEATABLE READ, FOR SHARE cannot see a row committed after the transaction snapshot, so this returns None and re-raises the duplicate-key failure.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Race condition

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/commands/dashboard/permalink/create.py
**Line:** 128:130
**Comment:**
	*Race Condition: With PostgreSQL `REPEATABLE READ`, `FOR SHARE` cannot see a row committed after the transaction snapshot, so this returns `None` and re-raises the duplicate-key failure.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@netlify

netlify Bot commented Oct 9, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit ed1077d
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ac94c2e9008ec00088d6bbf
😎 Deploy Preview https://deploy-preview-45152--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (6.2@b87a79e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
superset/daos/key_value.py 33.33% 1 Missing and 1 partial ⚠️
superset/commands/dashboard/permalink/create.py 50.00% 1 Missing ⚠️
superset/key_value/types.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             6.2   #45152   +/-   ##
======================================
  Coverage       ?   64.28%           
======================================
  Files          ?     2557           
  Lines          ?   133430           
  Branches       ?    30897           
======================================
  Hits           ?    85777           
  Misses         ?    46173           
  Partials       ?     1480           
Flag Coverage Δ
hive 39.70% <73.33%> (?)
mysql 60.13% <73.33%> (?)
postgres 60.21% <73.33%> (?)
presto 39.72% <73.33%> (?)
python 61.76% <73.33%> (?)
sqlite 59.85% <73.33%> (?)
unit 100.00% <ø> (?)

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant