Skip to content

Fix old pipe root user compatibility#17985

Open
Caideyipi wants to merge 4 commits into
apache:masterfrom
Caideyipi:fix/pipe-root-user-compat
Open

Fix old pipe root user compatibility#17985
Caideyipi wants to merge 4 commits into
apache:masterfrom
Caideyipi:fix/pipe-root-user-compat

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

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

@Caideyipi Caideyipi force-pushed the fix/pipe-root-user-compat branch from 5e12fe5 to 55de435 Compare June 18, 2026 08:40

// Pure in-memory object, not involved in snapshot serialization and deserialization.
private final PipeTaskInfoVersion pipeTaskInfoVersion;
private final BiFunction<String, String, String> pipeUserPasswordProvider;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain the parameters

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of the second parameter?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +1037 to +1040
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));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 3801d49: moved this error message into ConfigNodeMessages and added the constant to both en and zh i18n source sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants