worryg0d commented on code in PR #1868: URL: https://github.com/apache/cassandra-gocql-driver/pull/1868#discussion_r2000949093
########## conn.go: ########## @@ -1523,32 +1534,35 @@ func (c *Conn) UseKeyspace(keyspace string) error { return nil } -func (c *Conn) executeBatch(ctx context.Context, batch *Batch) *Iter { +func (c *Conn) executeBatch(ctx context.Context, b *internalBatch) *Iter { if c.version == protoVersion1 { - return &Iter{err: ErrUnsupported} + return newErrIter(ErrUnsupported, b.metrics) } - n := len(batch.Entries) + iter := newIter(b.metrics) + + n := len(b.batchOpts.Entries) req := &writeBatchFrame{ - typ: batch.Type, + typ: b.batchOpts.Type, statements: make([]batchStatment, n), - consistency: batch.Cons, - serialConsistency: batch.serialCons, - defaultTimestamp: batch.defaultTimestamp, - defaultTimestampValue: batch.defaultTimestampValue, - customPayload: batch.CustomPayload, + consistency: b.GetConsistency(), + serialConsistency: b.batchOpts.serialCons, + defaultTimestamp: b.batchOpts.defaultTimestamp, + defaultTimestampValue: b.batchOpts.defaultTimestampValue, + customPayload: b.batchOpts.CustomPayload, } - stmts := make(map[string]string, len(batch.Entries)) + stmts := make(map[string]string, len(b.batchOpts.Entries)) for i := 0; i < n; i++ { - entry := &batch.Entries[i] - b := &req.statements[i] + entry := &b.batchOpts.Entries[i] + batchStmt := &req.statements[i] if len(entry.Args) > 0 || entry.binding != nil { - info, err := c.prepareStatement(batch.Context(), entry.Stmt, batch.trace) + info, err := c.prepareStatement(b.batchOpts.context, entry.Stmt, b.batchOpts.trace) Review Comment: If I'm not missing anything here both `ctx` arg of the method and `b.batchOpts.context` should be have the same context value. The `ctx` arg is being passed by `queryExecutor.executeQuery()` at line 102 by calling `qry.Context()` which should return the underlying `internalBatch.batchOpts.context`. -- 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