Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(2.11) ADR-44: JetStream Asset Versioning in Metadata #5850

Merged
merged 12 commits into from
Sep 7, 2024

Conversation

MauriceVanVeen
Copy link
Member

@MauriceVanVeen MauriceVanVeen commented Aug 30, 2024

Implements ADR-44

Initial addition of JetStream Asset Versioning, containing:

  • generating stream and consumer metadata
    • created server version: _nats.created.server.version
    • created server API level: _nats.created.server.api_level
    • required server API level: _nats.server.require.api_level
  • logging supported API level upon startup: [INF] API Level: 1

Note that stream and consumer metadata is only set/updated upon:

  • creating a new stream/consumer
  • updating a stream/consumer
    (created metadata will not be set for pre-existing assets, only required level will be updated)

Many tests are added ensuring that:

  • restoring streams from backups doesn't set this metadata
    (if it doesn't exist, for example restoring a backup from a previous version)
  • restarting a server (or upgrading) doesn't set this metadata
    (if it doesn't exist, for example due to upgrading)
  • updating consumer PauseUntil ups or lowers required API level
  • metadata is consistently reported through add, update and info requests
  • only stream/consumer/meta leader determine the metadata, so that there can be no skew in metadata if followers were allowed to update as well
  • users can't manually supply these _nats.> metadata fields, they will be overwritten to the appropriate values
  • if the metadata is missing during an update, the metadata is preserved
    (for example an update by a client that doesn't know about metadata yet)

These tests check for both non-clustered R1 setups and clustered R3 setups.


This PR doesn't fully implement ADR-44. There will be follow-up PRs later on to add support for:

There are some slight inconsistencies between the ADR and this PR. For example using the terms feature level, api_version and api_level that all mean the same and are all made consistent to be api_level. I'll correct the ADR with any changed details after this PR has been merged.

Signed-off-by: Maurice van Veen [email protected]

@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner August 30, 2024 15:11
@ripienaar
Copy link
Contributor

Behaviour wise this is pretty spot on

Signed-off-by: Maurice van Veen <[email protected]>
Signed-off-by: Maurice van Veen <[email protected]>
Signed-off-by: Maurice van Veen <[email protected]>
@MauriceVanVeen MauriceVanVeen force-pushed the adr-44/jetstream-asset-versioning branch from 5ca862a to ca9ec95 Compare September 5, 2024 10:56
Signed-off-by: Maurice van Veen <[email protected]>
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need binary artifacts (the snapshots) store in GH? Can we just create them on the fly for the test?

Prefer not to have binary assets checked into GH if we can help it.

Signed-off-by: Maurice van Veen <[email protected]>
Signed-off-by: Maurice van Veen <[email protected]>
@derekcollison derekcollison self-requested a review September 7, 2024 01:15
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison merged commit a10dc6a into main Sep 7, 2024
3 of 5 checks passed
@derekcollison derekcollison deleted the adr-44/jetstream-asset-versioning branch September 7, 2024 01:18
derekcollison pushed a commit that referenced this pull request Sep 7, 2024
…5855)

Implements
[ADR-44](https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-44.md)
Extends #5850

Expose the supported JetStream API level in varz, jsz, statsz and
`$JS.API.INFO`. Both over the HTTP endpoints as well as requests to
`$SYS.REQ.SERVER.PING.VARZ` and the like.

Signed-off-by: Maurice van Veen <[email protected]>

---------

Signed-off-by: Maurice van Veen <[email protected]>
derekcollison pushed a commit that referenced this pull request Sep 7, 2024
Implements
[ADR-44](https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-44.md)
Extends #5850

Add dynamic JetStream stream/consumer metadata:
```
_nats.server.version
_nats.server.api_level
```

These are not persisted and are only returned in the response of a
create/update/info request.

Signed-off-by: Maurice van Veen <[email protected]>

---------

Signed-off-by: Maurice van Veen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants