KV Mirror with filter subject: Creation works but "No keys found in bucket" when listing keys #877
Replies: 6 comments
-
I'm starting to wonder if this is more of an issue with the NATS server (or CLI?) and the .NET client is correctly creating the mirror KV. Command: Seems to list things correctly. Though getting the key from the mirror KV doesn't work: |
Beta Was this translation helpful? Give feedback.
-
This is an issue with mirroring or filter subjects. I'm not sure how to resolve this yet. |
Beta Was this translation helpful? Give feedback.
-
Just a quick addition. Instead of mirroring I tried to use stest as the source for stest-invoices. It is showing identical behaviour: Here's the code:
Here's the stream report: And here's the info for the stest-invoices:
|
Beta Was this translation helpful? Give feedback.
-
Sorry for spamming... As the last idea I tried using "subject transform". Unfortunately the behavior is the same: bucket reports no keys even though they are in the stream. |
Beta Was this translation helpful? Give feedback.
-
It's a subject filter issue. I used JetStream directly to read the messages. In the stream for stest
In the stream for stest-invoices
The subject for the message in stest-invoices does not match the subject for a key in that bucket, so any KV operation, either through the cli or the .NET client will never find the key. It needs to be transformed. I'm working on figuring how to do it. |
Beta Was this translation helpful? Give feedback.
-
So problem figured out. There are two things here. 1. You have to use subject transform instead of subject filter and make sure the destination subject is correct.
2. I needed to fix something in the client, it could not properly lookup the key subject on a transform. it was a 1 line so that was good. I added a unit test in this PR: https://github.com/nats-io/nats.net/pull/878/files |
Beta Was this translation helpful? Give feedback.
-
Observed behavior
Here's the complete C# code I'm using to create two KV buckets, where the second one is the mirror of the first one with a subject filter defined:
Now when using the stest bucket through CLI things seem to work OK:
But the unexpected behavior is when trying to list the keys in the stest-invoices bucket:
No keys found in bucket
Expected behavior
Listing the keys in the mirror bucket should work OK.
Server and client version
nats-server: v2.10.11
nats cli: 0.1.3
"NATS.Client" Version="1.1.4"
Host environment
Windows 11
Steps to reproduce
Beta Was this translation helpful? Give feedback.
All reactions