Hi all,

I am integrating IoTDB table-model queries with Grafana through the Apache 
IoTDB Grafana data source plugin.

The plugin uses the Apache Go client:

github.com/apache/iotdb-client-go/v2 v2.0.8

I encountered error 715 when a query returns multiple pages of results:

error code: 715, message: Query is not found, it may be killed by others, 
timeout or some other runtime errors

Example query:

SELECT time, instance, metric_value / 100 AS cpu_usage
FROM metric_samples
WHERE metric_name = 'process_cpu_load'
AND cluster = 'defaultCluster'
AND node_type = 'DATANODE'

The default fetch size is 1024 rows. In one test, the query returned 4,323 
rows. The client successfully read all rows, but then issued one additional 
fetch request and failed with error 715.

The observed behavior was:

First page: 1024 rows
Second page: 1024 rows
Third page: 1024 rows
Fourth page: 1024 rows
Final page: 227 rows
Then error 715

After inspecting the source code, I found that IoTDB's server-side 
fetchResultsV2 implementation sets:

hasResultSet = !result.isEmpty()
moreData = !finished

Therefore, the final non-empty page can have:

hasResultSet = true
moreData = false

However, in the Go client's client/rpcdataset.go, the fetchResults function 
updates the query result but does not update the local moreData field from the 
server response. The client therefore continues to believe that more data is 
available and sends another request using the same query ID. The server has 
already completed and cleaned up the query, so it returns QUERY_WAS_KILLED 
(715).

The Java IoTDB client updates this state as follows:

moreData = resp.moreData;

I also tested a local copy of the Go client with the following line added:

s.moreData = resp.GetMoreData()

With this change, the same query completed successfully and returned all 4,323 
rows without error 715.

The current main branch of the iotdb-client-go repository appears to contain 
the same logic, and I could not find a newer v2 release after v2.0.8.

Best regards,
Xinqi Zhao

Reply via email to