This is an automated email from the ASF dual-hosted git repository. rong pushed a commit to branch query-memory-leak in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit a728ec3a70d1ddd3680c9cacb87f3e6f592d3233 Author: Steve Yurong Su <[email protected]> AuthorDate: Mon Aug 2 12:31:27 2021 +0800 fix leak in cpp client: statementId not set in TSCloseOperationReq --- client-cpp/src/main/Session.cpp | 5 +++-- client-cpp/src/main/Session.h | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client-cpp/src/main/Session.cpp b/client-cpp/src/main/Session.cpp index 8cc696b..286e3c9 100644 --- a/client-cpp/src/main/Session.cpp +++ b/client-cpp/src/main/Session.cpp @@ -339,6 +339,7 @@ void SessionDataSet::closeOperationHandle() { shared_ptr<TSCloseOperationReq> closeReq(new TSCloseOperationReq()); closeReq->__set_sessionId(sessionId); + closeReq->__set_statementId(statementId); closeReq->__set_queryId(queryId); shared_ptr<TSStatus> closeResp(new TSStatus()); try @@ -576,7 +577,7 @@ void Session::close() } shared_ptr<TSCloseSessionReq> req(new TSCloseSessionReq()); req->__set_sessionId(sessionId); - try + try { shared_ptr<TSStatus> resp(new TSStatus()); client->closeSession(*resp,*req); @@ -1146,7 +1147,7 @@ unique_ptr<SessionDataSet> Session::executeQueryStatement(string sql) } shared_ptr<TSQueryDataSet> queryDataSet(new TSQueryDataSet(resp->queryDataSet)); return unique_ptr<SessionDataSet>(new SessionDataSet( - sql, resp->columns, resp->dataTypeList, resp->queryId, client, sessionId, queryDataSet)); + sql, resp->columns, resp->dataTypeList, resp->queryId, statementId, client, sessionId, queryDataSet)); } void Session::executeNonQueryStatement(string sql) diff --git a/client-cpp/src/main/Session.h b/client-cpp/src/main/Session.h index 62995a4..f2c0ea7 100644 --- a/client-cpp/src/main/Session.h +++ b/client-cpp/src/main/Session.h @@ -505,6 +505,7 @@ private: bool hasCachedRecord = false; std::string sql; int64_t queryId; + int64_t statementId; int64_t sessionId; std::shared_ptr<TSIServiceIf> client; int batchSize = 1024; @@ -528,12 +529,13 @@ private: public: SessionDataSet(){} - SessionDataSet(std::string sql, std::vector<std::string>& columnNameList, std::vector<std::string>& columnTypeList, int64_t queryId, + SessionDataSet(std::string sql, std::vector<std::string>& columnNameList, std::vector<std::string>& columnTypeList, int64_t queryId, int64_t statementId, std::shared_ptr<TSIServiceIf> client, int64_t sessionId, std::shared_ptr<TSQueryDataSet> queryDataSet) : tsQueryDataSetTimeBuffer(queryDataSet->time) { this->sessionId = sessionId; this->sql = sql; this->queryId = queryId; + this->statementId = statementId; this->client = client; this->columnNameList = columnNameList; this->currentBitmap = new char[columnNameList.size()];
