Make sure only stream leader does a republish

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2022-06-05 15:27:07 -07:00
parent fddc31adb5
commit dfc74dd4c1
2 changed files with 2 additions and 2 deletions

View File

@@ -10662,7 +10662,7 @@ func TestJetStreamClusterStreamRepublish(t *testing.T) {
Name: "RP",
Storage: MemoryStorage,
Subjects: []string{"foo", "bar", "baz"},
Replicas: 1,
Replicas: 3,
RePublish: &RePublish{
Source: ">",
Destination: "RP.>",

View File

@@ -3569,7 +3569,7 @@ func (mset *stream) processJetStreamMsg(subject, reply string, hdr, msg []byte,
thdrsOnly = mset.cfg.RePublish.HeadersOnly
}
}
republish := tsubj != _EMPTY_
republish := tsubj != _EMPTY_ && isLeader
// We hold the lock to this point to make sure nothing gets between us since we check for pre-conditions.
// Currently can not hold while calling store b/c we have inline storage update calls that may need the lock.