btlqql opened a new pull request, #2516:
URL: https://github.com/apache/rocketmq-dashboard/pull/2516

   ## What is the purpose of the change
   
   Disabling administrator accounts was a check-then-update: `setUserEnabled` 
counted the enabled administrators, then flipped the flag. Two concurrent 
disables of different administrators could both read a count of 2 and both 
succeed, leaving the console with zero enabled administrators.
   
   ## Brief changelog
   
   - `setUserEnabled` now locks the enabled administrator rows (`SELECT ... FOR 
UPDATE`) inside a transaction before applying the last-admin guard, so 
concurrent disables serialize
   - the winner disables its target; the loser re-reads after the lock is 
released, sees a single remaining administrator, and fails with a 409
   - a target that was already disabled by a concurrent request is no longer 
mistaken for the "last administrator" and spuriously rejected
   - unit tests cover the guard, the two-admin case and the stale-read case; a 
new integration test races two disables through a `CyclicBarrier` against the 
real dev database and asserts exactly one wins
   
   ## How was this patch verified
   
   - server: `AuthServiceDatabaseTest` 10, 
`AuthServiceConcurrencyIntegrationTest` 1, 
`AuthServiceBootstrapIntegrationTest` 1, `AuthCookieProfileTest` 1 all green; 
full `mvn test` ran 1526 tests with only the 7 pre-existing environment 
failures in the CLI agent tests (missing `sh` binary on a Windows machine, 
identical on the clean base)
   
   Fixes #2484
   


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

Reply via email to