Skip to content

Commit ebf7ebe

Browse files
Fix alter pipe password check after restart for write-back sink.
Skip login lock for internal sessions used by pipe password validation, and avoid ArrayIndexOutOfBounds when parsing user@ip keys during lock cleanup. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0c25e53 commit ebf7ebe

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/LoginLockManager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,11 @@ public void cleanExpiredLocks() {
314314
// Remove outdated failures
315315
info.removeOldFailures(cutoffTime);
316316
if (info.getFailureCount() == 0) {
317-
String[] parts = entry.getKey().split("@");
318-
LOGGER.info(DataNodeMiscMessages.IP_UNLOCKED_EXPIRED, parts[1], parts[0]);
317+
final String[] parts = entry.getKey().split("@", 2);
318+
LOGGER.info(
319+
DataNodeMiscMessages.IP_UNLOCKED_EXPIRED,
320+
parts.length == 2 ? parts[1] : "",
321+
parts.length >= 1 ? parts[0] : "");
319322
return true;
320323
}
321324
return false;

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/SessionManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ public BasicOpenSessionResp login(
138138

139139
final long userId = AuthorityChecker.getUserId(username).orElse(-1L);
140140

141-
boolean enableLoginLock = userId != -1;
141+
// Pipe/CQ/Select-Into use InternalClientSession for password validation and should not
142+
// participate in user@ip login lock (empty client address shares one lock bucket).
143+
final boolean enableLoginLock =
144+
userId != -1 && session.getConnectionType() != TSConnectionType.INTERNAL;
142145
LoginLockManager loginLockManager = LoginLockManager.getInstance();
143146
if (enableLoginLock && loginLockManager.checkLock(userId, session.getClientAddress())) {
144147
// Generic authentication error

0 commit comments

Comments
 (0)