gavinchou opened a new pull request, #66673:
URL: https://github.com/apache/doris/pull/66673

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: N/A
   
   Problem Summary:
   
   Cloud-mode restrictions for Nereids commands were implemented as scattered 
overrides, and every caller had to remember to invoke a separate verification 
method before `run()`. This made the restrictions easy to bypass and left 
`ALTER RESOURCE` and `ALTER STORAGE POLICY` unprotected after their migration 
to Nereids commands.
   
   This PR:
   
   - adds a shared `Command.execute()` lifecycle (`before -> run -> after`) and 
routes production command invocations through it;
   - declares cloud restrictions with reusable `CloudUnsupportedCommand` and 
`CloudRootOnlyCommand` marker interfaces;
   - applies hard cloud-mode rejection to the unsupported admin, backup, 
resource, and storage-policy commands;
   - keeps `ADMIN SET FRONTEND CONFIG` and `ADMIN SHOW REPLICA DISTRIBUTION` 
root-only in cloud mode;
   - deliberately keeps `ADMIN COMPACT TABLE` supported;
   - adds lifecycle/mapping tests, SQL-entry tests, and a `cloud_p0` regression 
suite covering both ordinary admin and root users.
   
   ### Release note
   
   Fix cloud-mode validation for unsupported Nereids commands and centralize 
command restriction enforcement.
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] 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
   
   FE unit tests passed (17 tests):
   
   - `CloudRestrictedCommandTest`
   - `CloudUnsupportedCommandSqlTest`
   - `AdminSetFrontendConfigCommandTest`
   - `AdminSetReplicaVersionCommandTest`
   
   FE-only compilation passed. The new `cloud_p0` regression suite was added 
but was not run locally.
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. Cloud mode now consistently rejects the declared unsupported 
commands before command-specific validation or execution. `ALTER RESOURCE` and 
`ALTER STORAGE POLICY` are newly covered.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


-- 
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]

Reply via email to