Fix account unlock propagation for pipe password checks#17814
Open
Caideyipi wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What failed
IoTDBPipePermissionIT.testIllegalPasswordfailed with anAssertionErrorat:The test expected the receiver to eventually observe
count(root.vehicle.plane.pressure) = 2, but the count stayed at1.The cluster logs showed repeated pipe metadata push failures on one sender DataNode:
Why it failed
In this test, the pipe password is intentionally changed to an invalid/stale value after restart. The pipe keeps retrying with the stale password and can trigger the login lock for user
thulabon the DataNode that handles the pipe metadata push.The test then runs:
Before this patch,
ACCOUNT_UNLOCKwas handled only inside the DataNode that executed the SQL. It directly called the localLoginLockManagerand never went through the ConfigNode auth procedure. That means only one DataNode was unlocked, while another DataNode could still keepthulablocked in its local in-memory login-lock state.As a result, ConfigNode kept trying to push updated pipe metadata to the still-locked DataNode. That DataNode rejected the pipe password check, metadata synchronization was delayed, and the new insert was not replicated to the receiver before the assertion timed out.
Why this needs a cluster-wide fix
Login lock state is local DataNode memory, not persistent auth metadata stored only on ConfigNode. A user-level
ACCOUNT_UNLOCKstatement is therefore incomplete if it only clears the lock on the SQL coordinator DataNode. For pipe password checks, any DataNode can be the one validating the pipe credentials during metadata push/recovery, so the unlock needs to reach every DataNode.What this patch changes
This patch routes
ACCOUNT_UNLOCKthrough the normal ConfigNode auth operation procedure and reuses the existing DataNode permission-cache invalidation broadcast to clear the login lock on every DataNode.Concretely:
ConfigPhysicalPlanType.AccountUnlockand maps treeAuthorType.ACCOUNT_UNLOCKto it.RAccountUnlockhandling and adds the missing special mapping forAuthorRType.ACCOUNT_UNLOCK.LoginLockManagerentry and invalidates the user permission cache.AccountUnlockandRAccountUnlock.fail()assertion inIoTDBPipePermissionIT.testIllegalPasswordafter the intentionally invalid pipe password alteration.This avoids thrift IDL changes and keeps the unlock operation scoped to the existing auth-cache invalidation path.
Tests
I did not run the full
IoTDBPipePermissionIT#testIllegalPasswordClusterIT locally because this machine repeatedly hit Windows pagefile/native-memory exhaustion when starting forked JVMs. The focused compile and serialization checks above passed.