Hi, I have solved the issue. I create a new ThreadLocal field in TSServiceImpl class named queryId to generate unique queryId for each query in one session.
ThreadLocal<AtomicLong> queryId = new ThreadLocal<>(); And also, the key of queryStatus and queryDataSets is changed to Long type which is actually the queryId. The PR link is https://github.com/apache/incubator-iotdb/pull/522. > -----原始邮件----- > 发件人: "Yuan Tian (Jira)" <[email protected]> > 发送时间: 2019-11-05 11:29:00 (星期二) > 收件人: [email protected] > 抄送: > 主题: [jira] [Created] (IOTDB-290) Bug about threadlocal field in > TSServiceImpl.java > > Yuan Tian created IOTDB-290: > ------------------------------- > > Summary: Bug about threadlocal field in TSServiceImpl.java > Key: IOTDB-290 > URL: https://issues.apache.org/jira/browse/IOTDB-290 > Project: Apache IoTDB > Issue Type: Bug > Reporter: Yuan Tian > > > There are two fields named queryStatus and queryRet: > {code:java} > private ThreadLocal<HashMap<String, PhysicalPlan>> queryStatus = new > ThreadLocal<>(); > private ThreadLocal<HashMap<String, QueryDataSet>> queryRet = new > ThreadLocal<>(); > {code} > > They are used to save the PhysicalPlan and QueryDataSet of one query. > However, the keys of both are sql string to be executed, so if the client > execute the same sql in one connection, no matter whether the first execution > has finished, the second sql execution will clear the first one's > QueryDataSet. > > > > -- > This message was sent by Atlassian Jira > (v8.3.4#803005)
