When moving streams, we could check too soon and be in a gap where the
replica peer has not registered a catchup request but had made contact
via the NRG layer.
This would cause us to think the replica was caught up, incorrectly, and
drop our leadership, which would cancel any catchup requests.
Signed-off-by: Derek Collison <derek@nats.io>
This would cause us to think the replica was caughtup incorrectly and drop our leadership, which would cancel any cacthup requests.
Signed-off-by: Derek Collison <derek@nats.io>
Fix for a bug that would allow old leaders of pull based durables to
delete a consumer from an inactivity threshold timer inadvertently.
Signed-off-by: Derek Collison <derek@nats.io>
We violated the locking pattern, so we now make sure we do this in a
separate Go routine and put checks to only run it once.
Signed-off-by: Derek Collison <derek@nats.io>
If we send an event when entering lame duck mode, other nodes will mark
the server as offline immediately, therefore R1 assets will not be
placed onto that node. This is not a problem with R3 or higher because
an LDM server operates as a Raft observer only and therefore cannot take
the leadership role from an election, but R1 assets can in theory be
placed onto any node that is not marked as offline.
A final shutdown event will still be sent when the server actually shuts
down so there is no change there.
Signed-off-by: Neil Twigg <neil@nats.io>
We violated the locking pattern, so we now make sure we do this in a separate Go routine and put checks to only run it once.
Signed-off-by: Derek Collison <derek@nats.io>
- [X] Branch rebased on top of current main (`git pull --rebase origin
main`)
- [X] Changes squashed to a single commit (described
[here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
- [x] Build is green in Travis CI
- [X] You have certified that the contribution is your original work and
that you license the work to the project under the [Apache 2
license](https://github.com/nats-io/nats-server/blob/main/LICENSE)
Adds sfs to sourceInfo such that transforms with just a subject filter
(and no transformation, meaning that the transform pointer in streamInfo
is nil) can still be reflected in SourceInfo, which is important since
the filtering is still happening, just no transformation as well.
Adds sfs to SourceInfo such that transforms with just a subject filter (and no transformation, meaning that the transform pointer in streamInfo is nil) can still be reflected in SourceInfo, which is important since the filtering is still happening, just no transformation as well.
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
This should hopefully catch some consumer scaling situations more
reliably, including cases where the consumer filter subjects no longer
match those of the stream after being scaled down to R1 or after a
cluster restart. I've also added a test to test whether filtered
consumers will scale properly even when the stream subject orphans them.
Signed-off-by: Neil Twigg <neil@nats.io>
We rarely benefit from block profiles and in many cases a mutex profile
will tell us what we need to know. Additionally, setting the block
profile rate to `1` has the special meaning of capturing every single
blocking event, which can have a fairly significant negative impact on
publish performance.
Signed-off-by: Neil Twigg <neil@nats.io>
- [x] Build is green in Travis CI
- [X] You have certified that the contribution is your original work and
that you license the work to the project under the [Apache 2
license](https://github.com/nats-io/nats-server/blob/main/LICENSE)
Fixes potential out of range access during some stream source transform
configuration updates and tiny clean up
Fixes stream sourcing message header parsing for multi-subject transform
in sources
Clean up un-needed if statement as it's ok to call NewSubjectTransform with an empty destination (ie no transformation) it will return nil
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Allows again empty configs and improves support for detecting some types
of invalid configs:
- Adds reporting the line with the bad key position that makes the
config invalid.
```
nats-server: config is invalid (foo.conf:1:2)
nats-server: error parsing include file 'included.conf', config is invalid (included.conf:2:2)
```
- Fixes a few tests with trailing braces which were being handled as
keys and ignored before.
- Adds reporting the line with the bad key position
that makes the config invalid.
- Fixes a few tests with trailing braces which were
being handled as keys and ignored before.
Signed-off-by: Waldemar Quevedo <wally@nats.io>
- [X] Link to issue, e.g. `Resolves #NNN`
- [X] Branch rebased on top of current main (`git pull --rebase origin
main`)
- [ ] Changes squashed to a single commit (described
[here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
- [x] Build is green in Travis CI
- [X] You have certified that the contribution is your original work and
that you license the work to the project under the [Apache 2
license](https://github.com/nats-io/nats-server/blob/main/LICENSE)
Resolves#1556
### Changes proposed in this pull request:
Adds tw new $SYS server API endpoints:
- `$SYS.REQ.SERVER.%s.KICK` (where %s is the server_id) which 'kicks'
(effectiveley 'rebalance' as the client application reconnects itself
right away (potentially to another server in the cluster)). The service
takes a JSON payload containing either an "id" or a "name" field. "id"
disconnects the client connection id, "name" disconnects _all_ of the
clients connected to the server with that name.
- `$SYS.REQ.SERVER.%s.LDM` (where %s is the server_id) and takes a JSON
payload containing either an "id" or a "name" field. "id" sends an LDM
Info message to the client connection id, "name" sends an LDM Info
message to _all_ of the clients connected to the server with that name.
This features allow administrators to manually 're-balance' client
connections between the servers in the cluster (e.g. after a rolling
upgrade of the servers where one server ends up with no client
connections after the upgrade), by kicking some of the client
connections from one of the 'overloaded' (in comparison to other
servers) servers in the cluster, causing them to re-estalibsh their
connection to (hopefully) another server.