villebro opened a new pull request, #43492:
URL: https://github.com/apache/superset/pull/43492
### SUMMARY
Targets `gaq-to-gtf`. Loading a Deck.GL chart (and dashboards generally)
could fail with a spurious `{"message": "Lock already taken"}` error.
Several charts — or a chart's identical queries — can resolve to the **same
`query_cache_key`**, so they map to the same SHARED GTF task and the same
`dedup_key`, and submit concurrently. `task_lock` acquired that dedup lock
**fail-fast** (Redis `SET NX`), so the first submitter won the lock and created
the task, while every other concurrent submitter — which should simply
**join/subscribe** to that shared task — hit `LockAlreadyHeldException` and
errored out, failing the chart.
`task_lock` now **blocks and waits**: it retries the acquire until the
holder releases, then proceeds to join the now-existing task. The wait is
bounded by the lock TTL, so a holder that crashed without releasing is waited
out (the lock auto-expires) rather than blocking forever, and the lock is
released with the acquisition's own token (ownership-checked, matching the
existing `DistributedLock` behavior).
### TESTING INSTRUCTIONS
- `pytest tests/unit_tests/tasks/test_locks.py` — a held lock is retried
then acquired (concurrent submit joins), and a lock still held past the wait
window re-raises.
- End-to-end: open a Deck.GL chart / a dashboard whose charts share a query,
with `GLOBAL_ASYNC_QUERIES` on — the charts load instead of erroring with "Lock
already taken".
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [x] Required feature flags: `GLOBAL_ASYNC_QUERIES`
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
<!-- Follow-up: make the wait event-driven via the coordination Redis Streams
(release → notify, acquire → wait_for_signal) instead of the bounded
retry-poll. -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]