Skip to content

fix: optimize reconnect exception for IoTDB Python Client#18200

Merged
CRZbulabula merged 1 commit into
apache:masterfrom
Alchuang22-dev:fix-loginconnect
Jul 16, 2026
Merged

fix: optimize reconnect exception for IoTDB Python Client#18200
CRZbulabula merged 1 commit into
apache:masterfrom
Alchuang22-dev:fix-loginconnect

Conversation

@Alchuang22-dev

Copy link
Copy Markdown
Contributor

Description

IoTDB would only try to reconnect only when network exception occured, and 801/822 error would not trigger useless reconnection.

Content1

Divide Exception into TTransport.TTransportException and IoTDBConnectionException


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.

@CRZbulabula CRZbulabula 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.

LGTM!!!

Copilot AI 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.

Pull request overview

This PR adjusts the IoTDB Python client’s session open/reconnect behavior so that reconnect attempts are only triggered for transport/network failures, while IoTDB server status errors (e.g., authentication/account-blocked) fail fast without retrying.

Changes:

  • Narrow Session.open() reconnect-triggering exceptions to IoTDBConnectionException (instead of all Exception).
  • Refine init_connection() exception handling to wrap only TTransport.TTransportException as IoTDBConnectionException, while re-raising other exceptions after closing the transport.
  • Add unit tests to verify “no retry on TSStatus errors (801/822)” and “retry on transport errors”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
iotdb-client/client-py/iotdb/Session.py Limits reconnect logic to connection-level failures and ensures transport is closed on non-connection exceptions.
iotdb-client/client-py/tests/unit/test_session_connection.py Adds unit coverage validating retry vs. no-retry behavior for transport exceptions vs. IoTDB status errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CRZbulabula CRZbulabula merged commit eb9cc93 into apache:master Jul 16, 2026
45 of 46 checks passed
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.

3 participants