joao-r-reis commented on code in PR #1868:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1868#discussion_r2044760057


##########
query_executor.go:
##########
@@ -222,16 +238,452 @@ func (q *queryExecutor) do(ctx context.Context, qry 
ExecutableQuery, hostIter Ne
        }
 
        if lastErr != nil {
-               return &Iter{err: lastErr}
+               return newErrIter(lastErr, qry.getQueryMetrics(), 
qry.Keyspace(), qry.getRoutingInfo(), qry.getKeyspaceFunc())
        }
 
-       return &Iter{err: ErrNoConnections}
+       return newErrIter(ErrNoConnections, qry.getQueryMetrics(), 
qry.Keyspace(), qry.getRoutingInfo(), qry.getKeyspaceFunc())
 }
 
-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
+
+       // Paging
+       pageSize        int
+       disableAutoPage bool
+
+       // Monitoring
+       trace    Tracer
+       observer QueryObserver
+
+       // Parameters
+       values  []interface{}
+       binding func(q *QueryInfo) ([]interface{}, error)
+
+       // Timestamp
+       defaultTimestamp      bool
+       defaultTimestampValue int64
+
+       // Consistency
+       serialCons SerialConsistency
+
+       // Protocol flag
+       disableSkipMetadata bool
+
+       customPayload     map[string][]byte
+       prefetch          float64
+       rt                RetryPolicy
+       spec              SpeculativeExecutionPolicy
+       context           context.Context
+       idempotent        bool
+       keyspace          string
+       skipPrepare       bool
+       routingKey        []byte
+       nowInSecondsValue *int
+       hostID            string
+
+       // getKeyspace is field so that it can be overriden in tests
+       getKeyspace func() string
+}
+
+func newQueryOptions(q *Query, ctx context.Context) *queryOptions {
+       var newPageState, newRoutingKey []byte
+       if q.initialPageState != nil {
+               pageState := q.initialPageState
+               newPageState = make([]byte, len(pageState))
+               copy(newPageState, pageState)
+       }

Review Comment:
   Well the reason for this is to ensure that a query execution isn't affected 
if the user tries to modify the page byte slice after query has been submitted 
for execution



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to