This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 21df305d982 Add comments for some confusing parameters in SessionPool
and Session
21df305d982 is described below
commit 21df305d98234cff52680bc20dc18d352174d1ed
Author: Jackie Tien <[email protected]>
AuthorDate: Wed Jul 10 12:26:23 2024 +0800
Add comments for some confusing parameters in SessionPool and Session
---
.../java/org/apache/iotdb/session/Session.java | 29 ++++++++++++++++++++--
.../org/apache/iotdb/session/pool/SessionPool.java | 28 +++++++++++++++++++++
2 files changed, 55 insertions(+), 2 deletions(-)
diff --git
a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
index 26c716e3403..553c792c9d7 100644
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -143,7 +143,14 @@ public class Session implements ISession {
protected SessionConnection defaultSessionConnection;
private boolean isClosed = true;
- // Cluster version cache
+ // this field only take effect in write request, nothing to do with any
other type requests,
+ // like query, load and so on.
+ // if set to true, it means that we may redirect the write request to its
corresponding leader
+ // if set to false, it means that we will only send write request to first
available DataNode(it
+ // may be changed while current DataNode is not available, for example, we
may retry to connect
+ // to another available DataNode)
+ // so even if enableRedirection is set to false, we may also send write
request to another
+ // datanode while encountering retriable errors in current DataNode
protected boolean enableRedirection;
protected boolean enableRecordsAutoConvertTablet =
SessionConfig.DEFAULT_RECORDS_AUTO_CONVERT_TABLET;
@@ -167,9 +174,13 @@ public class Session implements ISession {
// The version number of the client which used for compatibility in the
server
protected Version version;
- // default enable
+ // set to true, means that we will start a background thread to fetch all
available (Status is
+ // not Removing) datanodes in cluster, and these available nodes will be
used in retrying stage
protected boolean enableAutoFetch = true;
+ // max retry count, if set to 0, means that we won't do any retry
+ // we can use any available DataNodes(fetched in background thread if
enableAutoFetch is true,
+ // or nodeUrls user specified) to retry, even if enableRedirection is false
protected int maxRetryCount = SessionConfig.MAX_RETRY_COUNT;
protected long retryIntervalInMs = SessionConfig.RETRY_INTERVAL_IN_MS;
@@ -3832,17 +3843,31 @@ public class Session implements ISession {
private ZoneId zoneId = null;
private int thriftDefaultBufferSize =
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY;
private int thriftMaxFrameSize = SessionConfig.DEFAULT_MAX_FRAME_SIZE;
+ // this field only take effect in write request, nothing to do with any
other type requests,
+ // like query, load and so on.
+ // if set to true, it means that we may redirect the write request to its
corresponding leader
+ // if set to false, it means that we will only send write request to first
available DataNode(it
+ // may be changed while current DataNode is not available, for example, we
may retry to connect
+ // to another available DataNode)
+ // so even if enableRedirection is set to false, we may also send write
request to another
+ // datanode while encountering retriable errors in current DataNode
private boolean enableRedirection = SessionConfig.DEFAULT_REDIRECTION_MODE;
private boolean enableRecordsAutoConvertTablet =
SessionConfig.DEFAULT_RECORDS_AUTO_CONVERT_TABLET;
private Version version = SessionConfig.DEFAULT_VERSION;
private long timeOut = SessionConfig.DEFAULT_QUERY_TIME_OUT;
+
+ // set to true, means that we will start a background thread to fetch all
available (Status is
+ // not Removing) datanodes in cluster, and these available nodes will be
used in retrying stage
private boolean enableAutoFetch = SessionConfig.DEFAULT_ENABLE_AUTO_FETCH;
private boolean useSSL = false;
private String trustStore;
private String trustStorePwd;
+ // max retry count, if set to 0, means that we won't do any retry
+ // we can use any available DataNodes(fetched in background thread if
enableAutoFetch is true,
+ // or nodeUrls user specified) to retry, even if enableRedirection is false
private int maxRetryCount = SessionConfig.MAX_RETRY_COUNT;
private long retryIntervalInMs = SessionConfig.RETRY_INTERVAL_IN_MS;
diff --git
a/iotdb-client/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
b/iotdb-client/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
index 2811193032c..209b4427929 100644
---
a/iotdb-client/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
+++
b/iotdb-client/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
@@ -111,6 +111,14 @@ public class SessionPool implements ISessionPool {
private String trustStorePwd;
private ZoneId zoneId;
+ // this field only take effect in write request, nothing to do with any
other type requests,
+ // like query, load and so on.
+ // if set to true, it means that we may redirect the write request to its
corresponding leader
+ // if set to false, it means that we will only send write request to first
available DataNode(it
+ // may be changed while current DataNode is not available, for example, we
may retry to connect
+ // to another available DataNode)
+ // so even if enableRedirection is set to false, we may also send write
request to another
+ // datanode while encountering retriable errors in current DataNode
private boolean enableRedirection;
private boolean enableRecordsAutoConvertTablet;
private boolean enableQueryRedirection = false;
@@ -147,8 +155,13 @@ public class SessionPool implements ISessionPool {
private INodeSupplier availableNodes;
+ // set to true, means that we will start a background thread to fetch all
available (Status is
+ // not Removing) datanodes in cluster, and these available nodes will be
used in retrying stage
private boolean enableAutoFetch = true;
+ // max retry count, if set to 0, means that we won't do any retry
+ // we can use any available DataNodes(fetched in background thread if
enableAutoFetch is true,
+ // or nodeUrls user specified) to retry, even if enableRedirection is false
protected int maxRetryCount = SessionConfig.MAX_RETRY_COUNT;
protected long retryIntervalInMs = SessionConfig.RETRY_INTERVAL_IN_MS;
@@ -3517,6 +3530,15 @@ public class SessionPool implements ISessionPool {
private int thriftMaxFrameSize = SessionConfig.DEFAULT_MAX_FRAME_SIZE;
private boolean enableCompression = false;
private ZoneId zoneId = null;
+
+ // this field only take effect in write request, nothing to do with any
other type requests,
+ // like query, load and so on.
+ // if set to true, it means that we may redirect the write request to its
corresponding leader
+ // if set to false, it means that we will only send write request to first
available DataNode(it
+ // may be changed while current DataNode is not available, for example, we
may retry to connect
+ // to another available DataNode)
+ // so even if enableRedirection is set to false, we may also send write
request to another
+ // datanode while encountering retriable errors in current DataNode
private boolean enableRedirection = SessionConfig.DEFAULT_REDIRECTION_MODE;
private boolean enableRecordsAutoConvertTablet =
SessionConfig.DEFAULT_RECORDS_AUTO_CONVERT_TABLET;
@@ -3527,10 +3549,16 @@ public class SessionPool implements ISessionPool {
private String trustStore;
private String trustStorePwd;
+ // set to true, means that we will start a background thread to fetch all
available (Status is
+ // not Removing) datanodes in cluster, and these available nodes will be
used in retrying stage
private boolean enableAutoFetch;
+ // max retry count, if set to 0, means that we won't do any retry
+ // we can use any available DataNodes(fetched in background thread if
enableAutoFetch is true,
+ // or nodeUrls user specified) to retry, even if enableRedirection is false
private int maxRetryCount = SessionConfig.MAX_RETRY_COUNT;
+ // sleep time between each retry
private long retryIntervalInMs = SessionConfig.RETRY_INTERVAL_IN_MS;
private long queryTimeoutInMs = SessionConfig.DEFAULT_QUERY_TIME_OUT;