You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We expect calls to Write/Flush to return a non-nil error on successful writes to the database.
Actual behavior
The returned error from Write/Flush is write: <nil> / flush: <nil> instead of a nil error.
Additional info
Looking at the code and commit history, I've found w.service.WriteBatch returns a concrete error type (i.e., *http2.Error).
However, returning a nil pointer (of type *http2.Error) as an interface is not a nil interface (i.e., nil) but a non-nil interface with a valid underlying type and a nil value.
So the test err != nil is always true.
I suggest a quick fix in Pull Request #359 , yet there may be merit in a more comprehensive refactoring to always return type error interface errors instead of the concrete *http2.Error.
Pull Request influxdata#350 (commit a9c1e37)
introduced `Flush()` and `Write()` functions blindly returning the
result of a `func (Service) WriteBatch(...) *http2.Error`.
This causes the returned error to always evaluate as `non-nil`.
Fixesinfluxdata#360
Specifications
Steps to reproduce
Influx PR draft
Create a new blocking write-API
Enable batching
Write/Flush
Expected behavior
We expect calls to Write/Flush to return a non-nil error on successful writes to the database.
Actual behavior
The returned error from Write/Flush is
write: <nil>
/flush: <nil>
instead of a nil error.Additional info
Looking at the code and commit history, I've found
w.service.WriteBatch
returns a concrete error type (i.e.,*http2.Error
).However, returning a nil pointer (of type
*http2.Error
) as an interface is not a nil interface (i.e.,nil
) but a non-nil interface with a valid underlying type and a nil value.So the test
err != nil
is always true.I suggest a quick fix in Pull Request #359 , yet there may be merit in a more comprehensive refactoring to always return
type error interface
errors instead of the concrete*http2.Error
.Possibly related Pull Requests:
A workaround for those who come across this issue in the meanwhile:
The text was updated successfully, but these errors were encountered: