diff --git a/coordinator.go b/coordinator.go index 2404a1de54..ec29d8e463 100644 --- a/coordinator.go +++ b/coordinator.go @@ -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 diff --git a/coordinator_test.go b/coordinator_test.go index 474cf576d0..32e3fa122a 100644 --- a/coordinator_test.go +++ b/coordinator_test.go @@ -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,