R.I.Pienaar
d6e63cb683
improve log line when account registration fails
...
Signed-off-by: R.I.Pienaar <rip@devco.net >
2021-03-18 12:19:23 +01:00
Ivan Kozlovic
ccec4a6ab1
Fixed consumer idle hearbeats and JS route/GWs unsubscribes
...
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-03-09 12:08:47 -07:00
Derek Collison
e70e46ea4a
Updates based on PR feedback
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-03-04 16:16:28 -08:00
Derek Collison
bfb8e3432e
Move RAFT comms off internal sendq.
...
Move route and gateway msgs our of fast path for inbound stream msgs.
Signed-off-by: Derek Collison <derek@nats.io >
2021-03-04 14:45:34 -08:00
Ivan Kozlovic
e7e756034a
Switch Gateway JS accounts to interest-only mode + some other fixes
...
- Fixed the close of a TLS connection which starting Go 1.16
set the deadline to 5 seconds.
- Fixed an issue with setHeader that was causing these error messages
```
=== RUN TestServiceImportReplyMatchCycleMultiHops
nats: message could not decode headers on connection [4] for subscription on "foo"
--- PASS: TestServiceImportReplyMatchCycleMultiHops (0.04s)
```
- Fixed names of tests in norace_test.go since they must start with
TestNoRace in order to make sure that we execute them in Travis:
```
go test -v -run=TestNoRace --failfast -p=1 ./...
```
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-03-03 19:15:28 -07:00
Matthias Hanel
25ef6b0f0d
Merge pull request #1952 from nats-io/goland-lint
...
Fixed linter issues
2021-03-02 21:43:04 -05:00
Matthias Hanel
c50ee2a1c6
[Changed] all times exposed will be computed in UTC ( #1943 )
...
This also applies to times that end up in that json.
Where applicable moved time.Now() to where it is used.
Moved calls to .UTC() to where time is created it that time is converted
later anyway.
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-03-02 21:37:42 -05:00
Matthias Hanel
4f2db7d187
Fixed linter issues
...
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-03-02 20:21:44 -05:00
Derek Collison
49cd38c064
Enable cross account behaviors for mirrors and sources.
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-03-02 06:36:57 -08:00
Derek Collison
44b08c538a
Pass deliver, don't remap
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-25 17:42:03 -08:00
Derek Collison
57403b1903
When pulling consumer messages if the consumer and the client were on the same server we needed to process local deliver subject.
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-24 19:28:46 -08:00
Derek Collison
3def02a459
check for '\n' at beginning og key
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-24 17:46:30 -08:00
Derek Collison
75fbcffedb
Make sure it's the exact key
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-24 14:56:44 -08:00
Derek Collison
36a2cbeff7
Cross account pull consumers would not work correctly due to reply subject rewrite.
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-24 13:33:24 -08:00
Derek Collison
a9394d7692
Handle JetStream subjects across GWs
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-23 10:56:24 -08:00
Ivan Kozlovic
2bd7a4d32e
Merge pull request #1926 from nats-io/mqtt_clustering
...
MQTT clustering
2021-02-19 11:45:19 -07:00
Ivan Kozlovic
7526c76703
Changes to setHeader
...
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-02-19 10:46:14 -07:00
Ivan Kozlovic
61bd1b8d86
MQTT clustering
...
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-02-19 08:50:00 -07:00
Ivan Kozlovic
eafc6b7a25
[fixed] LeafNode sending message using stream's import subject.
...
A publish on "a" becomes an LMSG on ">" which
is the stream import's subject. The subscriber on "a" on the other
side did not receive the message.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-02-19 00:11:41 -05:00
Matthias Hanel
b410026319
[fixed] out of range issue in processMsgResults during subject rewrite
...
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-02-18 16:16:41 -05:00
Derek Collison
4759560e29
Fixed raft bug on catchup logic with external snapshots
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-12 19:58:02 -08:00
Derek Collison
7facbc995b
More robust key detection per feedback
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-12 18:23:16 -08:00
Derek Collison
d803189eca
Changes needed to properly support multi-layer service imports for system services like JS.
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-12 17:01:32 -08:00
Derek Collison
fa8a95a06a
Improved snapshots and compactions.
...
Various bug fixes and stability improvements.
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-11 11:16:00 -08:00
Ivan Kozlovic
8af8cf4e67
Remap subject only for service imports
...
Also optimized a test that was taking too long to run.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-02-08 14:41:33 -07:00
Jaime Piña
71b842520b
Prevent non-exported messages from leaking into importer account ( #1891 )
...
* Add account isolation tests config & jwt
* Set the shadow subscription static subject
2021-02-08 14:07:18 -05:00
Ivan Kozlovic
d732c8fe82
Fixed bug that would prevent queue subs to ack messages
...
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-02-07 11:26:54 -07:00
Derek Collison
a1e0f7dc1a
First pass at supercluster enablement.
...
This allows metacontrollers to span superclusters. Also includes placement directives for streams. By default they select the request origin cluster.
Signed-off-by: Derek Collison <derek@nats.io >
2021-02-03 17:28:13 -08:00
Ivan Kozlovic
2b8c6e0124
Support for Websocket Leafnode connections
...
Added two options in the remote leaf node configuration
- compress, for websocket only at the moment
- ws_masking, to force remote leafnode connections to mask websocket
frames (default is no masking since it is communication between
server to server)
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-01-28 13:13:11 -07:00
Ivan Kozlovic
131be1cb33
Make TLS client/server handshake helpers function
...
This reduces code duplication
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-01-28 13:13:11 -07:00
Ivan Kozlovic
33694762b1
Merge pull request #1850 from nats-io/max_control_line
...
[CHANGED] Enforce max_control_line for client connections only
2021-01-26 16:25:28 -07:00
Matthias Hanel
dea9effa8d
[added] support for StrictSigningKeyUsage and updated jwt library ( #1845 )
...
This will cause the server to not trust accounts/user signed by an
identity key
The boot strapping system account will assume the account is issued by
the operator.
If this is not desirable, the system account can be provided right away
as resolver_preload.
[fixes] crash when the system account uses signing keys and an update changes that key set.
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-01-26 17:49:58 -05:00
Ivan Kozlovic
dce814009b
[CHANGED] Enforce max_control_line for client connections only
...
Only check limit for CLIENT connection types, however, the check
is done for CLIENT in all conditions, not only in the case of a
split buffer as it was the case so far.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-01-26 15:33:39 -07:00
Matthias Hanel
d35cd2996d
[added] jwt/issuerkey/nametag/tags to monitoring and event endpoints ( #1830 )
...
Also added a trace on jwt authentication
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-01-21 21:16:34 -05:00
Derek Collison
8dc1c42fe3
Bump version, remove spurious debug prints
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-01-20 11:58:31 -08:00
Derek Collison
fed4c0cce0
Race detector cacthes this now with 1.15.7
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-01-20 11:58:31 -08:00
Derek Collison
ff54c9dc9c
Reworked snapshot and restore.
...
Underestimated the effort to get stream restore working properly in cluster mode.
Some good bug fixes and stability improvments.
Signed-off-by: Derek Collison <derek@nats.io >
2021-01-20 11:58:31 -08:00
Ivan Kozlovic
1874964498
Merge pull request #1812 from nats-io/leafnode_fixes
...
Fixed some leafnode issues introduced from JS cluster work
2021-01-15 18:22:02 -07:00
Ivan Kozlovic
0d78bce9cf
Fixed some leafnode issues introduced from JS cluster work
...
Also fixed a flapper.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-01-15 12:00:34 -07:00
Ivan Kozlovic
343968067c
Merge pull request #1805 from nats-io/scoped-signing-keys
...
[added] enforcement and usage of scoped signing keys
2021-01-14 15:24:28 -07:00
Matthias Hanel
c14076b13f
Incorporating review comments
...
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-01-14 15:15:20 -05:00
Matthias Hanel
2edd883a6e
[added] enforcement and usage of scoped signing keys
...
Signed-off-by: Matthias Hanel <mh@synadia.com >
2021-01-14 14:52:54 -05:00
Ivan Kozlovic
6c4229300a
Fixed service import cycle detection that broke with JS clustering
...
Also added some no-op error handler for some tests to silence the
error report in the log.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-01-14 11:27:36 -07:00
Derek Collison
37cf7584bd
Merge branch 'master' into jsc
2021-01-14 02:52:35 -07:00
Derek Collison
f0cdf89c61
JetStream Clustering WIP
...
Signed-off-by: Derek Collison <derek@nats.io >
2021-01-14 01:14:52 -08:00
Ivan Kozlovic
7b116379cb
Propose going back to condition variable to notify writeLoop
...
This is how it was up to v2.1.2 included (changed in v2.1.4 onward).
I added a benchmark that has 3 subscribers running and increase
the number of publishers: 1, 2, 5 and 10. This is the comparison
between the pre-PR and post-PR:
```
benchcmp old.txt new.txt
benchmark old ns/op new ns/op delta
Benchmark___BumpPubCount_1x3-16 396 385 -2.78%
Benchmark___BumpPubCount_2x3-16 495 406 -17.98%
Benchmark___BumpPubCount_5x3-16 542 395 -27.12%
Benchmark__BumpPubCount_10x3-16 549 515 -6.19%
benchmark old MB/s new MB/s speedup
Benchmark___BumpPubCount_1x3-16 717.27 737.54 1.03x
Benchmark___BumpPubCount_2x3-16 574.31 699.02 1.22x
Benchmark___BumpPubCount_5x3-16 524.35 718.80 1.37x
Benchmark__BumpPubCount_10x3-16 517.26 551.53 1.07x
```
It is inline with what the user reported, seeing a 20% drop in performance
when going from 1 publisher to 2. But, as we can see, the difference
between go channel and cond variable reduces with the increased number
of publishers after a certain number.
I am not sure of the performance impact on other situations, so this
PR is more of a proposal than a fix.
Resolves #1786
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2021-01-12 12:24:37 -07:00
Derek Collison
a3f7e97f9a
Catch condition where a serviceImport response matched the original import subject.
...
Signed-off-by: Derek Collison <derek@nats.io >
2020-12-13 10:17:29 -08:00
Ivan Kozlovic
1d7c4712a5
Increase Pub performance
...
Essentially make publish a zero alloc. Use c.mqtt.pp as the parser
publish packet structure. Messages were initially copied because
MQTT messages don't have CR_LF but was adding it so that it worked
for NATS pub/subs and MQTT pub/subs.
Now an MQTT producer sending to NATS sub will queue CR_LF after
payload.
Here is result of benchcmp for MQTT pub runs only:
```
benchmark old ns/op new ns/op delta
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8 157 55.6 -64.59%
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8 167 61.0 -63.47%
BenchmarkMQTT_QoS0_Pub______32b_Payload-8 181 65.3 -63.92%
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8 243 78.1 -67.86%
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8 298 95.0 -68.12%
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8 604 224 -62.91%
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8 1713 1314 -23.29%
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8 1703 1311 -23.02%
BenchmarkMQTT_QoS1_Pub______32b_Payload-8 1722 1345 -21.89%
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8 2105 1432 -31.97%
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8 2148 1503 -30.03%
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8 3024 1889 -37.53%
benchmark old MB/s new MB/s speedup
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8 31.76 89.91 2.83x
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8 77.79 213.01 2.74x
BenchmarkMQTT_QoS0_Pub______32b_Payload-8 204.52 566.26 2.77x
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8 550.65 1715.96 3.12x
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8 877.77 2757.16 3.14x
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8 1705.02 4607.72 2.70x
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8 6.42 8.37 1.30x
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8 11.16 14.49 1.30x
BenchmarkMQTT_QoS1_Pub______32b_Payload-8 24.97 31.97 1.28x
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8 66.52 97.74 1.47x
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8 124.78 178.27 1.43x
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8 342.64 548.32 1.60x
benchmark old allocs new allocs delta
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8 3 0 -100.00%
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8 3 0 -100.00%
BenchmarkMQTT_QoS0_Pub______32b_Payload-8 3 0 -100.00%
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8 4 0 -100.00%
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8 4 0 -100.00%
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8 4 0 -100.00%
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8 5 2 -60.00%
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8 5 2 -60.00%
BenchmarkMQTT_QoS1_Pub______32b_Payload-8 5 2 -60.00%
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8 7 3 -57.14%
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8 7 3 -57.14%
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8 7 3 -57.14%
benchmark old bytes new bytes delta
BenchmarkMQTT_QoS0_Pub_______0b_Payload-8 80 0 -100.00%
BenchmarkMQTT_QoS0_Pub_______8b_Payload-8 88 0 -100.00%
BenchmarkMQTT_QoS0_Pub______32b_Payload-8 120 0 -100.00%
BenchmarkMQTT_QoS0_Pub_____128b_Payload-8 224 0 -100.00%
BenchmarkMQTT_QoS0_Pub_____256b_Payload-8 369 1 -99.73%
BenchmarkMQTT_QoS0_Pub_______1K_Payload-8 1250 31 -97.52%
BenchmarkMQTT_QoS1_Pub_______0b_Payload-8 106 28 -73.58%
BenchmarkMQTT_QoS1_Pub_______8b_Payload-8 122 28 -77.05%
BenchmarkMQTT_QoS1_Pub______32b_Payload-8 154 28 -81.82%
BenchmarkMQTT_QoS1_Pub_____128b_Payload-8 381 157 -58.79%
BenchmarkMQTT_QoS1_Pub_____256b_Payload-8 655 287 -56.18%
BenchmarkMQTT_QoS1_Pub_______1K_Payload-8 2312 1078 -53.37%
```
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2020-12-04 14:42:37 -07:00
Ivan Kozlovic
035cffae37
Add clientType() which returns NATS/MQTT/WS for CLIENT connections.
...
It returns NON_CLIENT if invoked from a non CLIENT connection.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2020-12-03 14:23:57 -07:00
Ivan Kozlovic
67425d23c8
Add c.isMqtt() and c.isWebsocket()
...
This hides the check on "c.mqtt != nil" or "c.ws != nil".
Added some tests.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com >
2020-12-02 15:52:06 -07:00