GithubHelp home page GithubHelp logo

Comments (13)

ripienaar avatar ripienaar commented on July 1, 2024 1

No, nothing is at 1.1 yet - feature list not complete either.

Try https://github.com/nats-io/jsm.go/compare/main...ripienaar:jsm.go:kv_topologies?expand=1

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

Looking at func mapStreamToKVS in nats.go/jetstream/kv.go, I suspect that nats.go might have the same problem, because kv.pre is not overwritten when info.Config.Mirror exists but m.External == nil. But I don't know Go and don't have Go dev.env. I know Python and tried nats.py, and couldn't do either "put" or "get" via a mirror.

Thanks in advance

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

hmm I see ADR-8 recently has received major updates regarding mirrors... should I read that first?

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

For mirrors you dont read from them, they are automatically used when reading - the nearest one is used and you cannot use them by name.

If you made a replica by source you could connect to it by name but we have no helpers for that. The only other option is there if you use leafnodes.

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

Sorry, correction, nats kv does have --source for source based replicas. Mirror as is should only be used with leafnodes and different domains.

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

thank you! so I should bind to a mirror only when its origin is in another domain.

I'm struggling to understand the test func TestKeyValueMirrorDirectGet in nats.go (and tests in other clients are based on it too of course). Both PUTs and GETs are done on the TEST bucket, so how does it prove that the mirror actually responds to DIRECT.GET? I.e. if I remove js.CreateStream from this test, it will nevertheless pass AFAICS.

sorry for off-topic, and probably questions like these belong to Slack. OTOH people can find answers on Github from googling.

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

You never can bind to a mirror - its subjects are just wrong. They are there for speeding up reads.

If you make a source based replicas as described in the recent edits to the ADR or using --source in the latest nats release it will be something you can bind to as the messages inside will have been rewritten to have the right subjects.

I suspect the test is just not very good :)

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

You never can bind to a mirror

but this is exactly what func TestKeyValueMirrorCrossDomains does! 😮

// Bind locally from leafnode and make sure both get and put work.
mkv, err := ljs.KeyValue(ctx, "MIRROR")

(proceeds with testing Put, Get and WatchAll)

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

Cross domains there's some special handling indeed, personally I'd avoid that. I dont want to support that method for a long time.

The source based method is right for all cases now.

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

ok, thank you so much for the clarification! I'll send everyone to read the updated ADR-8 :)

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

sorry for bothering you again, but do you know if any NATS client has (at least draft) implementation of ADR-8 v1.1, i.e. with the latest additions of KVAggregateConfig + KVAggregateOrigin ? I'd like to have some reference while implementing it. I thought that I might find it in some branch in nats.go, but nope =\

from natscli.

Kazmirchuk avatar Kazmirchuk commented on July 1, 2024

Thanks! I've implemented it - quite straightforward and indeed much cleaner than the previous approach with read and write subject prefixes that the client had to figure out based on a mirror configuration.

Do you mind if I provide some feedback about type KVAggregateOrigin? I found it a bit confusing that Stream is mandatory while Bucket is optional, and so users need to remember to prefix the stream name with KV_. What about designing it the other way round, i.e. Bucket is mandatory and Stream is optional (only for the cases when we source from a mirror)? Then users don't need to remember about the "KV_" prefix.

You can see how it looks like here lines 159 (only Bucket) and 198 (both Stream and Bucket). API docs here.

from natscli.

ripienaar avatar ripienaar commented on July 1, 2024

Thanks for the feedback, will check it out. The code I linked was pretty much just me making sure the spec can be implemented :) but will update there thank you!

from natscli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.