Commit 4598607
authored
(2.12) [ADDED] Offline assets support (#7158)
Implements [Offline Assets support from
ADR-44](https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-44.md).
Streams and consumers will be put in "offline mode" if the server
doesn't support the required API level.
Example:
```
[INF] ---------------- JETSTREAM ----------------
...
[INF] API Level: 2
[INF] -------------------------------------------
[WRN] Detected unsupported stream 'js > test-stream', delete the stream or upgrade the server to API level 10
[INF] Starting JetStream cluster
[INF] Creating JetStream metadata controller
[INF] JetStream cluster recovering state
[INF] Listening for client connections on 0.0.0.0:4444
[WRN] Detected unsupported stream 'js > test-stream', delete the stream or upgrade the server to API level 10
[INF] Server is ready
[INF] Cluster name is nats-cluster
```
Stream/consumer list and names requests still return the names of these
streams. Stream/consumer info still works in this state, and a
stream/consumer can still be deleted as well. The "offline reason" is
included as an error in the stream/consumer info requests and is
contained in the `offline: map[string]string` field in the list
requests.
These issues will be logged during startup, if an update request is
performed. The raw JSON is always preserved, so downgrading to a server
that doesn't understand the new JSON fields can safely upgrade and the
JSON will be preserved as expected. Importantly, if a stream or consumer
is recognized as unsupported, they are not even loaded by the server.
This means data will be safe and not even be loaded on an older version
server.
This will allow for more graceful downgrades from 2.12 to 2.11 (and
onward), where loads of new features would stop functioning after a
downgrade: counter-streams, atomic batch, etc.
Signed-off-by: Maurice van Veen <[email protected]>12 files changed
+1508
-90
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
510 | 519 | | |
511 | 520 | | |
512 | 521 | | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
513 | 526 | | |
514 | 527 | | |
515 | 528 | | |
| |||
5059 | 5072 | | |
5060 | 5073 | | |
5061 | 5074 | | |
5062 | | - | |
| 5075 | + | |
5063 | 5076 | | |
5064 | 5077 | | |
5065 | 5078 | | |
| |||
6103 | 6116 | | |
6104 | 6117 | | |
6105 | 6118 | | |
| 6119 | + | |
| 6120 | + | |
| 6121 | + | |
| 6122 | + | |
| 6123 | + | |
| 6124 | + | |
| 6125 | + | |
| 6126 | + | |
6106 | 6127 | | |
6107 | 6128 | | |
6108 | 6129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1918 | 1918 | | |
1919 | 1919 | | |
1920 | 1920 | | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
1921 | 1941 | | |
1922 | 1942 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
1333 | 1334 | | |
1334 | 1335 | | |
1335 | 1336 | | |
1336 | | - | |
1337 | | - | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
1338 | 1385 | | |
1339 | 1386 | | |
1340 | 1387 | | |
| |||
1510 | 1557 | | |
1511 | 1558 | | |
1512 | 1559 | | |
1513 | | - | |
1514 | | - | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
1515 | 1614 | | |
1516 | 1615 | | |
| 1616 | + | |
1517 | 1617 | | |
1518 | 1618 | | |
1519 | | - | |
| 1619 | + | |
1520 | 1620 | | |
1521 | 1621 | | |
1522 | 1622 | | |
| |||
0 commit comments