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

Support for new stream subject transform functionalities #695

Merged
merged 8 commits into from
Aug 11, 2023

Conversation

jnmoyne
Copy link
Contributor

@jnmoyne jnmoyne commented Feb 6, 2023

Support for the new stream subject transform functionalities:

  • subject tranform for stream sources
  • subject tranform for the stream input
  • sourcing for KV buckets

Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

Let some small comments, I need to see how this looks to really review the UX changes, will look fridayish.

cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/server_mapping_command.go Outdated Show resolved Hide resolved
@jnmoyne jnmoyne force-pushed the jnm/streamsourcetransform branch 3 times, most recently from 901e76e to 7bd478a Compare February 7, 2023 00:01
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

some small comments, need more time to run it and see how the UX feels

cli/kv_command.go Outdated Show resolved Hide resolved
cli/kv_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Show resolved Hide resolved
@ripienaar
Copy link
Collaborator

If you update to latest fisk release I think it will now do some dynamic column width adjustment and on larger displays no more wrapping of flags such that we have 10 more chars to play with for long flags.

Update to that lets see how it looks

Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

Very close now, this is amazing stuff really love it

cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
@ripienaar
Copy link
Collaborator

I have one general usability comment:

Given a stream with subjects js.in.test that gets transformed into js.test the js.Subscribe() based flows that looks up a stream by its subjects will not find any stream holding “js.test” messages which leads to some wtfs over and above the wtfs that API already causes.

I think probably the stream should be found by the fact that it holds those messages? Probably a server thing and maybe not fixable but just a weird UX thing I noticed that we might think about

@jnmoyne
Copy link
Contributor Author

jnmoyne commented Feb 17, 2023

About the general usability comment: yes the current js.Subscribe() is a bit broken/too limited, at least the part that tries to find the stream from the subject name being subscribed to. It all comes from the initial JS client API design which (understandably but erroneously) assumes there's a one-to-one link between the subjects a stream currently listens on and the subjects of the messages stored in that stream. That one-to-one hard link was there initially when there was no mirroring/sourcing and you could not modify existing stream attributes, but stopped being there when those features were introduced, and now stream subject transforms is really making it even more obvious that the link between what a stream currently happens to be listening on and the subjects of messages in the streams is no longer there.

Stream subject transform is a bit the final nail in that coffin, but trying to find the stream from just the subject you subscribe to is fundamentally wrong now, even if you tried to look at the subjects of the messages in the stream (can't just look at the current transform as that also can change over the lifespan of the stream) you can have more than one stream with messages on a particular subject and there's no way the subscribe would be able to know which of those streams you actually want to consume from.

The proper/actual solution to this is already in the works: the JS simplification effort where the JS API no longer try to find the stream from the subject you subscribe to but rather the new simplified JS API requires you explicitly pass the stream name to create a consumer on it.

@jnmoyne jnmoyne force-pushed the jnm/streamsourcetransform branch from 2af2c5d to ef7a92f Compare May 9, 2023 19:36
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

Left a few comments, I see some earlier ones also still outstanding, looking good!

cli/stream_command.go Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
@jnmoyne jnmoyne force-pushed the jnm/streamsourcetransform branch from ef7a92f to a0178a4 Compare May 16, 2023 00:09
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

Looking good, just remove all the redundant humanize calls.

Only time we need them now is with AddRowf()

cli/kv_command.go Outdated Show resolved Hide resolved
cli/kv_command.go Outdated Show resolved Hide resolved
@ripienaar
Copy link
Collaborator

@jnmoyne how are we on this? Can you rebase? People desperate for the CLI release so I want to get this one in.

@jnmoyne
Copy link
Contributor Author

jnmoyne commented Aug 8, 2023

I'd also like to get this one finally merged :). Actually rebased yet again 5 days ago but yeah needed another one since, which is done now.

@jnmoyne
Copy link
Contributor Author

jnmoyne commented Aug 8, 2023

The status is that it's still good to go. Since that PR was created there's been additional functionality (i.e. multi subject support) in stream sources and mirroring which this doesn't cover as I'd rather create a new PR for those. If you'd prefer I did those changes in new commits to this branch instead let me know.

@ripienaar
Copy link
Collaborator

The status is that it's still good to go. Since that PR was created there's been additional functionality (i.e. multi subject support) in stream sources and mirroring which this doesn't cover as I'd rather create a new PR for those. If you'd prefer I did those changes in new commits to this branch instead let me know.

Unfortunately looks like latest clean up introduced a number of formatting bugs and code layout changes etc, left some comments there.

Is the server work in 2.10 now done and merged completely?

I prefer smaller PRs for sure. so do not want to add to this. Even this I'd have done as many PRs rather than a huge singe PR :)

cli/consumer_command.go Outdated Show resolved Hide resolved
cli/kv_command.go Outdated Show resolved Hide resolved
cli/kv_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
Remove redundant humanize
Make a few things consistent and cleanup a couple redundancies from the merge
Implement PR feedback
Source details made more compact
Make test check for both arguments being non-null to improve readability
Adds lag/last seen/external/error for sources in KV info
improve stream report
Rebase merge from main
Add empty lines around control statements to improve readability
Update go.mod for nats.go to the 2.10.0 branch current latest commit
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

small changes left

cli/kv_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
Clean up republish flag
Simplify and fix config checking for republish
Add empty lines around control statements to improve readability
Update go.mod for nats.go to be able to build
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

very very close now :)

cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Outdated Show resolved Hide resolved
cli/stream_command.go Show resolved Hide resolved
Improved checking of republish and transform arguments being passed in create, copy and edit
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

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

LGTM

@jnmoyne jnmoyne merged commit 3edc322 into main Aug 11, 2023
4 checks passed
@jnmoyne jnmoyne deleted the jnm/streamsourcetransform branch August 11, 2023 22:54
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.

2 participants