mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-14 10:10:42 -07:00
Make sure only stream leader does a republish
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -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.>",
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user