From fb8f612afebc25984d02999fac5dfa3aa37a0743 Mon Sep 17 00:00:00 2001 From: Travis Date: Thu, 27 Feb 2020 12:57:50 -0600 Subject: [PATCH] very crude fix for the translate key read-only bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR forces the non-coordinator nodes to reset their translation sync (and therefore their own cosideration of read-only partitions) any time they receive a `ClusterStatus` message. So basically, as the cluster grows during the startup process, each node will reset their translation sync. This is NOT a good solution log term, but it should address the immediate problem. Things to note: - the coordinator sync isn't getting reset, but that's ok, because the immediate problem is a partition marked as read-only when it shouldn't be; i.e. it's ok to have the inverse (a partition not marked as read-only when it should be) because that partition won't receive requests anyway. - the last node to start is already correct and doesn't really need to reset its sync. - there are many other scenarios not covered by this fix. Based on this theory: ``` i have another theory that i’m going to try to test. this one would only apply in the case where a multi-node cluster is restarted with an existing, keyed index. - start node0: it thinks it’s responsible for all partitions (nothing is read-only) - start node1: it thinks it’s responsible for ~1/2 of the partitions and marks the other 1/2 as read-only - start node2: it thinks it’s responsible for ~1/3 of the partitions and marks the other 2/3 as read-only now if node0 is the coordinator receiving all translation requests, that still might not explain what’s happening, because in that case it would just do all the translating. i think. but either way, i should make sure that scenario is not happening, but i think it may be. actually, that might explain it, because what would happen when the coordinator received a translation request, is that it would handle the 1/3 that it owned (now that the cluster is 3 nodes), and it would send the other 2/3 out to the other 2 nodes. but where it sent the requests wouldn’t line up with what the nodes thought they were responsible for based on the restart order in this example, node 1 would receive requests for the wrong partitions ``` --- server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.go b/server.go index 455e4dd59..5c97dd82c 100644 --- a/server.go +++ b/server.go @@ -725,6 +725,11 @@ func (s *Server) receiveMessage(m Message) error { if err != nil { return err } + if s.syncer.Cluster != nil { + if err := s.syncer.ResetTranslationSync(); err != nil { + return err + } + } case *ResizeInstruction: err := s.cluster.followResizeInstruction(obj) if err != nil {