GoCB Query changes are as follows:
GoCBv1 - Query is made when we execute the query, all the results are pulled down and stored in memory and a results iterator is returned so we can work with the results. The query connection is closed as soon as we have all the results in memory.
GoCBv2 - Query is established when we execute the query but rather than storing all results in memory the data is streamed over as we iterate over the results. The connection is only closed when we call Close() on the results.
Currently we have implemented a throttle to limit the number of concurrent view ops / query ops by applying the limit to the Query function(s). However, due to the above changes in V2 this is not adequate as it is only limiting that initial establish. We should instead cover the full window from opening the connection to closing the connection.
Therefore proposed change:
Rather than running releaseViewOp() as part of the Query operation this should be called in the Close() function. This should just mean that we can store the operation (whether in channel form or some sort of function) on gocbRawIterator so we can call that as part of Close().
Should ensure that we still release that view op in the event of some sort of query error too. ie - ensuring in an error we still call Close() and don't just quit out.