Add tests for partial writes with errors
parent
6e5da3a77d
commit
580bbeaba0
|
@ -229,9 +229,9 @@ func (c *Coordinator) writeToShards(shard meta.ShardInfo, consistency Consistenc
|
|||
case res := <-ch:
|
||||
wrote += res.wrote
|
||||
|
||||
// ErrShardNotLocal might be returned from a local writer. Ignore it.
|
||||
if res.err != nil && res.err != ErrShardNotLocal {
|
||||
return res.err
|
||||
// If the write returned an error, continue to the next response
|
||||
if res.err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// We wrote the required consistency level
|
||||
|
|
|
@ -192,7 +192,7 @@ func TestCoordinatorWrite(t *testing.T) {
|
|||
dnErr: influxdb.ErrShardNotLocal,
|
||||
cwWrote: 1,
|
||||
cwErr: influxdb.ErrShardNotFound,
|
||||
expErr: influxdb.ErrShardNotFound,
|
||||
expErr: influxdb.ErrPartialWrite,
|
||||
},
|
||||
// Consistency any
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ func TestCoordinatorWrite(t *testing.T) {
|
|||
expErr: influxdb.ErrWriteFailed,
|
||||
},
|
||||
{
|
||||
name: "write any not local, remote success",
|
||||
name: "write any local failed, remote success",
|
||||
consistency: influxdb.ConsistencyLevelAny,
|
||||
dnWrote: 0,
|
||||
dnErr: influxdb.ErrShardNotLocal,
|
||||
|
@ -232,13 +232,13 @@ func TestCoordinatorWrite(t *testing.T) {
|
|||
expErr: nil,
|
||||
},
|
||||
{
|
||||
name: "write any not local, remote success",
|
||||
name: "write any local failed, remote success",
|
||||
consistency: influxdb.ConsistencyLevelAny,
|
||||
dnWrote: 0,
|
||||
dnErr: influxdb.ErrShardNotLocal,
|
||||
cwWrote: 1,
|
||||
cwErr: influxdb.ErrShardNotFound,
|
||||
expErr: influxdb.ErrShardNotFound,
|
||||
expErr: influxdb.ErrPartialWrite,
|
||||
},
|
||||
|
||||
// Consistency all
|
||||
|
@ -260,6 +260,15 @@ func TestCoordinatorWrite(t *testing.T) {
|
|||
cwErr: nil,
|
||||
expErr: influxdb.ErrPartialWrite,
|
||||
},
|
||||
{
|
||||
name: "write all, one error, one success",
|
||||
consistency: influxdb.ConsistencyLevelAll,
|
||||
dnWrote: 0,
|
||||
dnErr: influxdb.ErrTimeout,
|
||||
cwWrote: 1,
|
||||
cwErr: nil,
|
||||
expErr: influxdb.ErrPartialWrite,
|
||||
},
|
||||
{
|
||||
name: "write all, 1/3",
|
||||
consistency: influxdb.ConsistencyLevelAll,
|
||||
|
|
Loading…
Reference in New Issue