Skip to content

Commit 8d367a2

Browse files
wenyanshi-123JackieTien97
authored andcommitted
Fix compatibility issues when loading snapshot in pipe. (#16580)
1 parent c0068a4 commit 8d367a2

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/source/ConfigRegionListeningQueue.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,21 @@ public synchronized void tryListenToSnapshots(
157157
: null,
158158
snapshotPathInfo.getRight());
159159
if (type == CNSnapshotFileType.USER_ROLE) {
160-
long userId = Long.parseLong(snapshotPath.toFile().getName().split("_")[0]);
161-
try {
162-
curEvent.setAuthUserName(
163-
ConfigNode.getInstance()
164-
.getConfigManager()
165-
.getPermissionManager()
166-
.getUserName(userId));
167-
} catch (AuthException e) {
168-
LOGGER.warn("Failed to collect user name for user id {}", userId, e);
160+
String userName = snapshotPath.toFile().getName().split("_")[0];
161+
long userId;
162+
if (userName.matches("\\d+")) {
163+
userId = Long.parseLong(userName);
164+
try {
165+
curEvent.setAuthUserName(
166+
ConfigNode.getInstance()
167+
.getConfigManager()
168+
.getPermissionManager()
169+
.getUserName(userId));
170+
} catch (AuthException e) {
171+
LOGGER.warn("Failed to collect user name for user id {}", userId, e);
172+
}
173+
} else {
174+
curEvent.setAuthUserName(userName);
169175
}
170176
}
171177
events.add(curEvent);

0 commit comments

Comments
 (0)