This is similar to PR #4115 but for LeafNodes.
Compression mode can be set on both side (the accept and in remotes).
```
leafnodes {
port: 7422
compression: s2_best
remotes [
{
url: "nats://host2:74222"
compression: s2_better
}
]
}
```
Possible modes are similar than for routes (described in PR #4115),
except that when not defined we default to `s2_auto`.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
- [X] Tests added
- [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)
### Changes proposed in this pull request:
There is currently a blanket requirement that subject transforms
destinations MUST use ALL of the partial wildcards defined in the source
of the transform. This is because the subject transformed defined for
imports must be 'reversible' and therefore the destination transform
must use all of the partial wildcard tokens defined in the source of the
transform.
This reversing of a transform is only used for transforms used by
imports, where in any case it doesn't make sense to use any transform
other than Wildcard.
This PR:
- relaxes this requirement to only apply when the transform is used by
an import, adding the ability to drop a wildcard token in transforms
other than as part of an import.
- Improves transform reverse to support both legacy style wildcards $X
and the new transform function {{Wildcard(X)}}- Improves reversible
transform checking to only allow the use of wildcards in the
destination.
---------
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
For some older R1 streams created by previous servers we could have no
cluster for the stream assignment group which would prevent scale up
with newer servers.
This will inherit cluster if detected as absent from the placement tags
or client cluster designation.
Signed-off-by: Derek Collison <derek@nats.io>
When doing leadership transfer stepdown as soon as we know we have sent
the EntryLeaderTransfer entry.
Delaying could allow something to be sent from the old leader which
would cause the new leader to bail on being a candidate even though it
would have gotten all the votes.
Signed-off-by: Derek Collison <derek@nats.io>
Delaying could allow something to be sent from the old leader which would cause the new leader to bail on being a candidate even though it would have gotten all the votes.
Signed-off-by: Derek Collison <derek@nats.io>
This is a fix for PR https://github.com/nats-io/nats-server/pull/4115.
If a server has an s2_auto configuration, the compression level needs to
be updated based on the RTT, however, this should not happen if a
particular route is actually not using compression, either because it is
a connection to an older server or the other side has explicitly
configure compression to be "off".
Extended a test that would have caught this issue.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This is a fix for PR https://github.com/nats-io/nats-server/pull/4001.
If a server has an s2_auto configuration, the compression level
needs to be updated based on the RTT, however, this should not
happen if a particular route is actually not using compression,
either because it is a connection to an older server or the other
side has explicitly configure compression to be "off".
Extended a test that would have caught this issue.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Bump various GitHub Actions versions to move away from those using the
deprecated node.js 12 runtime, and so remove the warnings.
For the coveralls action, I switched to just `@v2`, per their example
docs and as we do for most actions, instead of major.minor.patch.
For Golang, update one 1.16 to 1.19, and quote the remaining unquoted
instances, even though they had `.x` in there so had to parse as
strings, because we're just switching to always-quoting for consistency.
Bump various GitHub Actions versions to move away from those using the
deprecated node.js 12 runtime, and so remove the warnings.
For the coveralls action, I switched to just `@v2`, per their example docs and
as we do for most actions, instead of major.minor.patch.
For Golang, update one 1.16 to 1.19, and quote the remaining unquoted
instances, even though they had `.x` in there so had to parse as strings,
because we're just switching to always-quoting for consistency.
Added a leafnode lock to allow better traversal without copying of large
leafnodes in a single hub account.
Signed-off-by: Derek Collison <derek@nats.io>
Added a leafnode lock to allow better traversal without copying of large leafnodes in a single hub account.
Signed-off-by: Derek Collison <derek@nats.io>
In #1943 it was adopted to use `UTC()` in some timestamps, but an
unintended side effect from this is that it strips the monotonic time
(e5646b23de),
so it can be prone to clock skews when subtracting time in other areas
of the code.
In #1943 it was adopted to use `UTC()` in some timestamps,
but an unintended side effect from this is that it strips
the monotonic time, so it can be prone to clock skews when
subtracting time in other areas of the code.
e5646b23de
If consumer with multiple subjects encountered a sequnece of messages in
a row from the same subject, it tried to load messages from other
subjects in some cases.
This checks for that scenario and optimizes it by early returning.
I added a temporary instrumentation to check for how many times fetching
new messages is called, and it seems that it cuts those calls according
to assumptions. Though it being internal, it's really hard to show that
in test.
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
If consumer with multiple subjects encountered a sequnece
of messages from the same subject, it tried to load messages
from other subjects in some cases.
This checks for that scenario and optimizes it by early returning.
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>