Skip to content

Commit b9d45e0

Browse files
committed
Reduce distributor memory usage during periods of high error volume
Signed-off-by: Xiaochao Dong (@damnever) <[email protected]>
1 parent 1ba4bca commit b9d45e0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pkg/ring/batch.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ func (b *batchTracker) record(instance instance, err error) {
152152
if err != nil {
153153
// Track the number of errors by error family, and if it exceeds maxFailures
154154
// shortcut the waiting rpc.
155-
wrappedErr := httpgrpcutil.WrapHTTPGrpcError(err, "addr=%s state=%s zone=%s", instance.desc.Addr, instance.desc.State, instance.desc.Zone)
156-
errCount := instance.itemTrackers[i].recordError(wrappedErr)
155+
errCount := instance.itemTrackers[i].recordError(err)
157156
// We should return an error if we reach the maxFailure (quorum) on a given error family OR
158157
// we dont have any remaining ingesters to try
159158
// Ex: 2xx, 4xx, 5xx -> return 4xx
@@ -162,13 +161,17 @@ func (b *batchTracker) record(instance instance, err error) {
162161
// Ex: 5xx, _, 5xx -> return 5xx
163162
if errCount > int32(sampleTrackers[i].maxFailures) {
164163
if b.rpcsFailed.Inc() == 1 {
165-
b.err <- httpgrpcutil.WrapHTTPGrpcError(sampleTrackers[i].getError(), "maxFailure (quorum) on a given error family")
164+
b.err <- httpgrpcutil.WrapHTTPGrpcError(
165+
sampleTrackers[i].getError(), "maxFailure (quorum) on a given error family, addr=%s state=%s zone=%s",
166+
instance.desc.Addr, instance.desc.State, instance.desc.Zone)
166167
}
167168
continue
168169
}
169170
if sampleTrackers[i].remaining.Dec() == 0 {
170171
if b.rpcsFailed.Inc() == 1 {
171-
b.err <- httpgrpcutil.WrapHTTPGrpcError(sampleTrackers[i].getError(), "not enough remaining instances to try")
172+
b.err <- httpgrpcutil.WrapHTTPGrpcError(
173+
sampleTrackers[i].getError(), "not enough remaining instances to try, addr=%s state=%s zone=%s",
174+
instance.desc.Addr, instance.desc.State, instance.desc.Zone)
172175
}
173176
continue
174177
}
@@ -187,7 +190,9 @@ func (b *batchTracker) record(instance instance, err error) {
187190
// Ex: 4xx, 5xx, 2xx
188191
if sampleTrackers[i].remaining.Dec() == 0 {
189192
if b.rpcsFailed.Inc() == 1 {
190-
b.err <- httpgrpcutil.WrapHTTPGrpcError(sampleTrackers[i].getError(), "not enough remaining instances to try")
193+
b.err <- httpgrpcutil.WrapHTTPGrpcError(
194+
sampleTrackers[i].getError(), "not enough remaining instances to try, addr=%s state=%s zone=%s",
195+
instance.desc.Addr, instance.desc.State, instance.desc.Zone)
191196
}
192197
}
193198
}

0 commit comments

Comments
 (0)