Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblanet <moweng.xx@alibaba-inc.com>2021-06-22 10:29:14 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-02 08:23:55 +0300
commitee820fe9b2e6c0575fcde871dec73fb0ddad726b (patch)
treed18142e915e5e11fa5a0cf6a197e0b25458589b2
parent671edfdb202bca762734c8dc6a2f7fb4d5cabc17 (diff)
praefect: Fix incorrect error tracking for secondaries
We use `nodeErrors` to track secondary errors of transaction involving RPCs, but there is a bug that the `ErrHandler` of each secondary is sharing the same variable `secondary` from the for-range loop. Thus we would always mark (and only mark) the last secondary error once there are any secondary errors. And what we would get from `getUpdatedAndOutdatedSecondaries` later is probably wrong. We can fix this by creating a new variable with the same name in for-range loop. Changelog: fixed (cherry picked from commit b76154dd7dce4aa7b5d3fa7416d1697965b656d0)
-rw-r--r--internal/praefect/coordinator.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index 5af1619fe..682de22e6 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -481,6 +481,7 @@ func (c *Coordinator) mutatorStreamParameters(ctx context.Context, call grpcCall
}
for _, secondary := range route.Secondaries {
+ secondary := secondary
secondaryMsg, err := rewrittenRepositoryMessage(call.methodInfo, call.msg, secondary.Storage)
if err != nil {
return nil, err