You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "jt2594838 (via GitHub)" <gi...@apache.org> on 2025/04/14 10:22:55 UTC
Re: [PR] Feature/node supplier [iotdb]
jt2594838 commented on code in PR #15230:
URL: https://github.com/apache/iotdb/pull/15230#discussion_r2041821904
##########
iotdb-client/client-cpp/src/main/Session.cpp:
##########
@@ -795,6 +828,26 @@ void Session::initZoneId() {
zoneId = zoneStr;
}
+void Session::initNodesSupplier() {
+ std::vector<TEndPoint> endPoints;
+ TEndPoint endPoint;
+ endPoint.__set_ip(host);
+ endPoint.__set_port(rpcPort);
+ endPoints.emplace_back(endPoint);
+ if (enableAutoFetch) {
+ nodesSupplier = NodesSupplier::create(endPoints, username, password);
+ } else {
+ nodesSupplier = make_shared<DummyNodesSupplier>(endPoints);
Review Comment:
I think this class may be better called StaticNodesSupplier rather than Dummy.
Usually, DummyXXX does not produce meaningful results.
##########
iotdb-client/client-cpp/src/main/Session.h:
##########
@@ -685,6 +707,11 @@ class Tablet {
}
}
+ void addTimestamp(size_t rowIndex, int64_t timestamp) {
+ timestamps[rowIndex] = timestamp;
+ rowSize = max(rowSize, rowSize + 1);
Review Comment:
rowSize = max(rowSize, rowIndex + 1);
##########
iotdb-client/client-cpp/src/main/Session.cpp:
##########
@@ -50,12 +51,38 @@ void RpcUtils::verifySuccess(const TSStatus &status) {
verifySuccess(status.subStatus);
return;
}
+ if (status.code == TSStatusCode::REDIRECTION_RECOMMEND) {
+ return;
+ }
if (status.code != TSStatusCode::SUCCESS_STATUS
&& status.code != TSStatusCode::REDIRECTION_RECOMMEND) {
throw ExecutionException(to_string(status.code) + ": " + status.message, status);
}
Review Comment:
The condition seems redundant.
##########
iotdb-client/client-cpp/src/main/Session.cpp:
##########
@@ -50,12 +51,38 @@ void RpcUtils::verifySuccess(const TSStatus &status) {
verifySuccess(status.subStatus);
return;
}
+ if (status.code == TSStatusCode::REDIRECTION_RECOMMEND) {
+ return;
+ }
if (status.code != TSStatusCode::SUCCESS_STATUS
&& status.code != TSStatusCode::REDIRECTION_RECOMMEND) {
throw ExecutionException(to_string(status.code) + ": " + status.message, status);
}
}
+void RpcUtils::verifySuccessWithRedirection(const TSStatus &status) {
+ verifySuccess(status);
+ if (status.__isset.redirectNode) {
+ throw RedirectException(to_string(status.code) + ": " + status.message, status.redirectNode);
+ }
+ if (status.__isset.subStatus) {
+ auto statusSubStatus = status.subStatus;
+ vector<TEndPoint> endPointList(statusSubStatus.size());
+ int count = 0;
+ for (TSStatus subStatus : statusSubStatus) {
+ if (subStatus.__isset.redirectNode) {
+ endPointList[count++] = subStatus.redirectNode;
+ } else {
+ TEndPoint endPoint;
+ endPointList[count++] = endPoint;
+ }
+ }
+ if (!endPointList.empty() && count > 0) {
Review Comment:
Is it possible that enPointList is empty but count > 0?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org