worryg0d commented on issue #1746: URL: https://github.com/apache/cassandra-gocql-driver/issues/1746#issuecomment-2609512132
Ok, now I see the difference. Cassandra when LWT is applied returns a **single** column `[applied]`, but Scylla also returns the table columns. So, the result is 1 col for Cassandra and 5 for Scylla on our table. The driver [checks](https://github.com/apache/cassandra-gocql-driver/blob/48bb2bc2b499d9f96764d64944be769f3d8068bc/session.go#L1613) whether is there enough destination variables to scan the result and if not enough it returns an error. However, [here](https://github.com/apache/cassandra-gocql-driver/blob/48bb2bc2b499d9f96764d64944be769f3d8068bc/session.go#L788) the driver doesn't account for `iter.err` and just returns `nil`. If we adjust the code above then the driver will properly handle the `applied` value: ```go var ( keyRead string tsRead int64 colRead string valRead string ) applied, _, err := tx.session.ExecuteBatchCAS(b, &keyRead, &colRead, &tsRead, &valRead) ``` @joao-r-reis I think this is a good idea to make `ExecuteBatchCAS()` return `iter.err` instead of `nil` as we do in `MapExecuteBatchCAS()`: ```go func (s *Session) ExecuteBatchCAS(batch *Batch, dest ...interface{}) (applied bool, iter *Iter, err error) { iter = s.executeBatch(batch) if err := iter.checkErrAndNotFound(); err != nil { iter.Close() return false, nil, err } if len(iter.Columns()) > 1 { dest = append([]interface{}{&applied}, dest...) iter.Scan(dest...) } else { iter.Scan(&applied) } return applied, iter, nil // here is nil returned, but should be iter.err } ``` -- 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]
