When a msg blk was not writen correctly, but the idx file was, max bytes for a stream would no longer be honored since the deletion of any messages in that empty block were not being handled properly.
Signed-off-by: Derek Collison <derek@nats.io>
Also added in healthz for single server systems to make sure all stream directories resulted in recovered streams.
Signed-off-by: Derek Collison <derek@nats.io>
When a leafnode connection is bound to an account where there was already
a wildcard response import subscription to handle the requests (e.g. `_R_.foo.>`),
this would have created message duplicates due to an extra subscription
being created that also matched the wildcard (e.g. `_R_.foo.bar`).
To avoid this condition, we now skip creating the latter extra subscription
for leafnode connections.
Signed-off-by: Waldemar Quevedo <wally@nats.io>
This adds the ability to augment or override the NATS auth system.
A server will send a signed request to $SYS.REQ.USER.AUTH on the specified account. The request will contain client information, all client options sent to the server, and optionally TLS information and client certificates.
The external auth service will respond with an empty message if not authorized, or a signed User JWT that the user will bind to.
The response can change the account the client will be bound to.
Signed-off-by: Derek Collison <derek@nats.io>
This fixes a backwards incompat change for library usage as well as
using the healthz NATS API which depends on the JSON payload.
Signed-off-by: Byron Ruth <byron@nats.io>
The startup delay when starting as a service under windows was set to 10
seconds.
This value was fixed and hardcoded since before JetStream. On (some)
Windows systems, this leads to service startup failures, as the store
dir sorting may be hindered by an important load, or slowed down by
increased accesses times, typically from security software influence.
This commit allows overriding the startup delay using an environment
variable NATS_STARTUP_DELAY. This variable is checked outside init() to
allow reporting into the service log.
Any value can be used (even lower than the initial 10s). Bare NATS
start can be far faster than 10s. Ops may want to setup this env var to
lower values in order to trigger an error on stricter constraints.