Skip to content

Refactor ConfigNode client/info and DirectoryChecker into node-common… - #18561

Open
shizy818 wants to merge 3 commits into
apache:masterfrom
shizy818:IoTDBStartCheck
Open

Refactor ConfigNode client/info and DirectoryChecker into node-common…#18561
shizy818 wants to merge 3 commits into
apache:masterfrom
shizy818:IoTDBStartCheck

Conversation

@shizy818

@shizy818 shizy818 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

…s for reuse

Description

Content1 ...

Content2 ...

Content3 ...


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

public void invalidate() {
Optional.ofNullable(transport).ifPresent(TTransport::close);
protected String getNodeTypeName() {
return "DataNode";

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.

better define a string constant

return result;
@Override
protected String getNodeTypeName() {
return "datanode";

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.

reuse the string constant, and why here lower case and previous is upper case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just try to follow original logs:
"Failed to connect to ConfigNode {} from DataNode {} ..."
"Removing is only allowed in an environment where the datanode has been successfully ..."

@JackieTien97 JackieTien97 left a comment

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.

Requesting changes because the refactor is not behaviorally equivalent on the existing CGLIB construction path and it breaks the usable ClientManager type. Details are inline.

* @param <R> the type of rpc result
* @throws TException if fails more than RETRY_NUM times, throw TException(MSG_RECONNECTION_FAIL)
*/
protected <R> R executeRemoteCallWithRetry(final Operation<R> call, final Predicate<R> check)

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.

[P1] Preserve the original dispatch semantics under CGLIB

These helpers were private before the refactor, but ConfigNodeClient instances are CGLIB subclasses created by SyncThriftClientWithErrorHandler. Making executeRemoteCallWithRetry (and likewise connectAndSync and updateConfigNodeLeader) non-final protected methods means self-invocations are now intercepted, including during construction. I reproduced this with the CGLIB 3.3.0 version used by the project: getStackTrace()[2] becomes a CGLIB$executeRemoteCallWithRetry$... frame, terminal exceptions are resolved and wrapped twice, and an unchecked exception from updateConfigNodeLeader is converted to TException and retried instead of failing fast. Please keep these internal template methods non-overridable, and make the concrete hook overrides final, or filter the enhancer so that it intercepts only the intended public RPC entry points.

protected AbstractConfigNodeClient(
List<TEndPoint> configNodes,
ThriftClientProperty property,
ClientManager<ConfigRegionId, ? super AbstractConfigNodeClient> clientManager)

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.

[P2] Preserve the concrete client type in ClientManager

ClientManager<ConfigRegionId, ConfigNodeClient>, which was accepted by the old public constructor and is the type used by Factory, is not assignable to ClientManager<ConfigRegionId, ? super AbstractConfigNodeClient>. The current factory works only because reflective construction erases this generic signature; direct callers and future concrete subclasses cannot pass their naturally typed manager. Please retain the concrete self type through the base class, for example AbstractConfigNodeClient<C extends AbstractConfigNodeClient<C>> with ClientManager<ConfigRegionId, C>.

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