Fix old pipe root user compatibility#17985
Conversation
5e12fe5 to
55de435
Compare
|
|
||
| // Pure in-memory object, not involved in snapshot serialization and deserialization. | ||
| private final PipeTaskInfoVersion pipeTaskInfoVersion; | ||
| private final BiFunction<String, String, String> pipeUserPasswordProvider; |
There was a problem hiding this comment.
Addressed in 3801d49: changed this from BiFunction<String, String, String> to Function<String, String> and renamed it to pipeUserCurrentPasswordProvider. The single parameter now clearly means username, and the return value is the current stored password for pipe authentication.
| } | ||
|
|
||
| final String rootUserName = CommonDescriptor.getInstance().getConfig().getDefaultAdminName(); | ||
| final String password = pipeUserPasswordProvider.apply(rootUserName, null); |
There was a problem hiding this comment.
What is the point of the second parameter?
There was a problem hiding this comment.
Addressed in 3801d49: removed the second parameter from the pipe metadata layer. ConfigManager now adapts PermissionManager.login4Pipe with userName -> login4Pipe(userName, null), because this compatibility path only needs to fetch the current stored root password.
| throw new PipeException( | ||
| String.format( | ||
| "Failed to enrich pipe %s with root user for compatibility because root user %s does not exist.", | ||
| pipeStaticMeta.getPipeName(), rootUserName)); |
There was a problem hiding this comment.
Addressed in 3801d49: moved this error message into ConfigNodeMessages and added the constant to both en and zh i18n source sets.
Description
When old pipe metadata created before the user and permission system is loaded, automatically enrich missing local IoTDB source and write-back sink credentials with the current root user and encrypted password.
This keeps upgraded old user pipes runnable while avoiding overwriting existing credentials, system pipes, or normal remote IoTDB thrift sinks.
Tests
mvn -nsu -pl iotdb-core/node-commons,iotdb-core/confignode -Dtest=PipeTaskInfoAutoRestartTest "-Dsurefire.failIfNoSpecifiedTests=false" test