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

   ### What problem does this PR solve?
   
   `InsertOverwriteTableCommand` runs its internal partition-replacement work
   with `ConnectContext.skipAuth=true` for OLAP targets, and clears the flag
   in a `finally` block. The flag was set *before* that `try` block, so if any
   statement in between returned early or threw — for example the
   `@branch`-on-non-iceberg guard, or `recordRunningTableOrException` when the
   same table already has an overwrite running — the method exited without the
   `finally` ever running, and `skipAuth` stayed set for the rest of that
   connection.
   
   ### What changed
   
   - Set `skipAuth` as the first statement *inside* the existing `try` block,
     gated on a local flag so the OLAP-only behavior is unchanged, and restore
     the previous value in `finally` so set and reset are always paired.
   - Apply the same save/restore pattern to the two other manual `skipAuth`
     toggles (`MaterializedViewUtils`, `CreateTableLikeCommand`) so a hard
     `false` no longer clobbers an outer scope. Neither of those leaked, this
     just keeps the toggle balanced.
   
   ### Test
   
   Added `InsertOverwriteSkipAuthResetTest`: runs a failing
   `INSERT OVERWRITE ... @branch` against an OLAP table and asserts
   `skipAuth` is reset afterwards. It fails on the old code
   (`expected: <false> but was: <true>`) and passes with this change.
   
   ### Checklist
   
   - [x] Regression test added
   - [x] `mvn checkstyle:check -pl fe-core` passes


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