mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-17 03:24:40 -07:00
With snapshots both streams are present on restart so sources or mirrors that have a subject change from the origin would not recover.
We now suppress that if we know we are recovering an existing stream. Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
committed by
Ivan Kozlovic
parent
52b5cd12bb
commit
91edd1a8d0
@@ -953,7 +953,7 @@ func (s *Server) shutdownJetStream() {
|
||||
}
|
||||
js.mu.Unlock()
|
||||
|
||||
// If we were clustered signal the monitor consumer go routine.
|
||||
// If we were clustered signal the monitor cluster go routine.
|
||||
// We will wait for a bit for it to close.
|
||||
// Do this without the lock.
|
||||
if qch != nil {
|
||||
|
||||
@@ -1044,6 +1044,12 @@ func (s *Server) checkStreamCfg(config *StreamConfig, acc *Account) (StreamConfi
|
||||
var deliveryPrefixes []string
|
||||
var apiPrefixes []string
|
||||
|
||||
// Some errors we want to suppress on recovery.
|
||||
var isRecovering bool
|
||||
if js := s.getJetStream(); js != nil {
|
||||
isRecovering = js.isMetaRecovering()
|
||||
}
|
||||
|
||||
// Do some pre-checking for mirror config to avoid cycles in clustered mode.
|
||||
if cfg.Mirror != nil {
|
||||
if len(cfg.Subjects) > 0 {
|
||||
@@ -1062,7 +1068,7 @@ func (s *Server) checkStreamCfg(config *StreamConfig, acc *Account) (StreamConfi
|
||||
if cfg.MaxMsgSize > 0 && maxMsgSize > 0 && cfg.MaxMsgSize < maxMsgSize {
|
||||
return StreamConfig{}, NewJSMirrorMaxMessageSizeTooBigError()
|
||||
}
|
||||
if !hasFilterSubjectOverlap(cfg.Mirror.FilterSubject, subs) {
|
||||
if !isRecovering && !hasFilterSubjectOverlap(cfg.Mirror.FilterSubject, subs) {
|
||||
return StreamConfig{}, NewJSStreamInvalidConfigError(
|
||||
fmt.Errorf("mirror '%s' filter subject '%s' does not overlap with any origin stream subject",
|
||||
cfg.Mirror.Name, cfg.Mirror.FilterSubject))
|
||||
@@ -1102,7 +1108,7 @@ func (s *Server) checkStreamCfg(config *StreamConfig, acc *Account) (StreamConfi
|
||||
if cfg.MaxMsgSize > 0 && maxMsgSize > 0 && cfg.MaxMsgSize < maxMsgSize {
|
||||
return StreamConfig{}, NewJSSourceMaxMessageSizeTooBigError()
|
||||
}
|
||||
if !hasFilterSubjectOverlap(src.FilterSubject, streamSubs) {
|
||||
if !isRecovering && !hasFilterSubjectOverlap(src.FilterSubject, streamSubs) {
|
||||
return StreamConfig{}, NewJSStreamInvalidConfigError(
|
||||
fmt.Errorf("source '%s' filter subject '%s' does not overlap with any origin stream subject",
|
||||
src.Name, src.FilterSubject))
|
||||
|
||||
Reference in New Issue
Block a user