lukasz-antoniak commented on code in PR #1868:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1868#discussion_r2009655505
##########
query_executor.go:
##########
@@ -201,16 +210,375 @@ func (q *queryExecutor) do(ctx context.Context, qry
ExecutableQuery, hostIter Ne
}
if lastErr != nil {
- return &Iter{err: lastErr}
+ return newErrIter(lastErr, qry.getQueryMetrics())
}
- return &Iter{err: ErrNoConnections}
+ return newErrIter(ErrNoConnections, qry.getQueryMetrics())
}
-func (q *queryExecutor) run(ctx context.Context, qry ExecutableQuery, hostIter
NextHost, results chan<- *Iter) {
+func (q *queryExecutor) run(ctx context.Context, qry internalRequest, hostIter
NextHost, results chan<- *Iter) {
select {
case results <- q.do(ctx, qry, hostIter):
case <-ctx.Done():
}
- qry.releaseAfterExecution()
+}
+
+type queryOptions struct {
+ stmt string
+ values []interface{}
+ initialConsistency Consistency
+ pageSize int
+ initialPageState []byte
+ prefetch float64
+ trace Tracer
+ observer QueryObserver
+ rt RetryPolicy
+ spec SpeculativeExecutionPolicy
+ binding func(q *QueryInfo) ([]interface{}, error)
+ serialCons SerialConsistency
+ defaultTimestamp bool
+ defaultTimestampValue int64
+ disableSkipMetadata bool
+ context context.Context
+ idempotent bool
+ customPayload map[string][]byte
+ keyspace string
+ disableAutoPage bool
+ skipPrepare bool
+ routingKey []byte
+
+ // getKeyspace is field so that it can be overriden in tests
+ getKeyspace func() string
+}
+
+func newQueryOptions(q *Query) *queryOptions {
+ return &queryOptions{
+ stmt: q.stmt,
+ values: q.values,
+ initialConsistency: q.initialConsistency,
+ pageSize: q.pageSize,
+ initialPageState: q.initialPageState,
+ prefetch: q.prefetch,
+ trace: q.trace,
+ observer: q.observer,
+ rt: q.rt,
+ spec: q.spec,
+ binding: q.binding,
+ serialCons: q.serialCons,
+ defaultTimestamp: q.defaultTimestamp,
+ defaultTimestampValue: q.defaultTimestampValue,
+ disableSkipMetadata: q.disableSkipMetadata,
+ context: q.Context(),
+ idempotent: q.idempotent,
+ customPayload: q.customPayload,
+ disableAutoPage: q.disableAutoPage,
+ skipPrepare: q.skipPrepare,
+ routingKey: q.routingKey,
+ getKeyspace: q.getKeyspace,
+ }
+}
+
+type internalQuery struct {
+ originalQuery *Query
+ qryOpts *queryOptions
+ pageState []byte
+ metrics *queryMetrics
+ refCount uint32
Review Comment:
Unused?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]