xy720 opened a new pull request, #67004:
URL: https://github.com/apache/doris/pull/67004
### What problem does this PR solve?
Assume that mtmv A,B,C,D share same base tables.
We found a lock competition case between them and create new mtmv. Like:
```
T0 T1 T2 T3 T4 T5
T6
│ │ │ │ │ │
│
┌─ Refresh mv_A ────────────────────────────────────────────────┐
│ plan (holds R on mv_A,B,C,D) │ │ W(A) │ BE run │ W(A) │
│ ═══════════════════════════ │ │══════│ │══════│
└──────────────────────────────┘
┌─ Refresh mv_B ────────────────────────────────────────────────┐
│ plan │ │ W(B) │ BE run │ W(B) │
│ ═══ │ │══════│ │══════│
└──────┘
┌─ Refresh mv_C
─────────────────────────────────────────────────┐
│ plan │ │ W(C) │ BE run │ W(C) │
│ ═══ │ │══════│ │══════│
└──────┘
┌─ Refresh mv_D (arrives here)
──────────────────────────────────┐
│ plan: tryReadLock(mv_A) — mv_A currently write-locked
│
│ ════════════ waits ════════════ 60s timeout
│
│ => throw "Failed to get read lock on table:mv_A"
│
└────────────────────────────────────────────────────────────────┘
⋮ (concurrent scheduler keeps firing refresh_E, _F,
...
each shares the base table, each hits the same
wall,
each occupies a worker for a full retry cycle)
⋮ → mtmv worker pool saturates, queue backlog grows
⋮ → mv_A/B/C write-lock windows keep cycling and never
clear the fair-lock queue for read waiters
┌─ CREATE MATERIALIZED VIEW mv_X
─────────────────────┐
│ base table is the same as
A/B/C/D... │
│ tryReadLock(mv_A) — still
contested │
│ ══════════════ waits
══════════════ 60s => error │
└─────────────────────────────────────────────────────┘
```
If there is mv_E,mv_F,mv_G... before create mv_X, the mv_X may be never
created and retry until timeout, throwing MySQL socket read timeout (180s).
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [x] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]