yujun777 opened a new pull request, #69256: URL: https://github.com/apache/doris/pull/69256
### What problem does this PR solve? Issue Number: None Problem Summary: Two lock/journaling gaps in the MTMV metadata path. `ALTER_REFRESH_INFO` and `ALTER_STATUS` changed the MV metadata under the MV write lock but enqueued the matching journal record only after that lock was released (`Alter.processAlterMTMV`). A task result journaled in between could be replayed on the other side of the alter, and a live `ALTER_STATUS` could lose its record if a later step threw after the metadata had already moved. `MTMV.getIvmInfo()` took the MV write lock on the query path (`isIvm()` reads it). `enableIvm` is decided at CREATE and no ALTER path changes it, and the only other mutable field, the sequence prefix, is read when a refresh plans and advanced when the same refresh's transaction commits -- both under the MV's `MTMVJob` write lock, which serializes refreshes of one MV. Changes: - Apply `ALTER_REFRESH_INFO` / `ALTER_STATUS` and submit their journal record under one MV write lock; `processAlterMTMV` awaits the entry after the lock is released, like the other journaled MTMV changes. - Make `getIvmInfo()` a lock-free read and mark the payload reference `volatile`, so a replay that replaces it publishes it safely. `isIvm()` and `getNextSequencePrefix()` no longer queue for the MV write lock. - Correct the `MTMVTask` comment that claimed base table snapshots were captured under a read lock: they are captured before the read, without one. - The remaining item of the same list, the `addTaskResult` race on `getPartitionNames()`, was fixed separately by #69166. Related to the IVM tracker https://github.com/apache/doris/issues/65418. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [x] Unit Test - Behavior changed: - [ ] No. - [x] Yes. `ALTER_REFRESH_INFO` / `ALTER_STATUS` now enqueue their journal record before the job update and wait for it to flush before returning; previously the record was written after the job update. No user-visible capability changes. - Does this need documentation? - [x] No. ### 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]
