cockroachdb / cockroachdb/cockroach
kvserver: build server side rangefeed crdb_internal table
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Currently, we only have client side rangefeed crdb_internal table https://github.com/cockroachdb/cockroach/blob/d9220e9f700a9521fff0702404c35a2945976ad3/pkg/sql/crdb_internal.go#L7535-L7551. They expose the client side view of rangefeeds. But it is hard to say if the server side rangefeeds actually started and how they are looking like. We can build a server side rangefeed crdb_internal table to expose more information. It should contain similar entries as the client side, but we can think of more such as the server side replica id.
We could explore the idea of using Inspectz tooling to power this table. Some work in progress: https://github.com/cockroachdb/cockroach/pull/141380/files.
- [x] High water mark
- [ ] Last event
- [ ] How many events they were sent and how many is in the catch up buffer
- Buffered registration: Number of events written to the buffer but not sent yet https://github.com/cockroachdb/cockroach/blob/da8dc489a7614fee0c6679526d5683cdf15dc6f2/pkg/kv/kvserver/rangefeed/buffered_registration.go#L68
- Unbuffered registration: do something similar to the buffered registration above and bump the counter if we are sending the events to the catch up buffer https://github.com/cockroachdb/cockroach/blob/f24aa26b1ecb39733b2eeecd8eb9454bb9ee144b/pkg/kv/kvserver/rangefeed/unbuffered_registration.go#L163
- [ ] Server side mux stream
- [ ] Average time spent sent to the stream
- Total time spent: end time from https://github.com/cockroachdb/cockroach/blob/e92993fc438aa397ada35694f5429c34268e0da9/pkg/server/node.go#L2106 and start time could be the mvcc timestamp of the event but we should double check if this is a viable comparison.
- Total events sent to the stream
- [x] One row per scheduler v.s. one row per replica
- [x] Whether we are currently in catch up mode
- [x] Consumer ID, tags
- https://github.com/cockroachdb/cockroach/blob/e92993fc438aa397ada35694f5429c34268e0da9/pkg/server/node.go#L2225-L2231
- https://github.com/cockroachdb/cockroach/blob/797a63b1cab9b2e1dafb71a9cdb0e28cd3a6ef8d/pkg/kv/kvserver/rangefeed/registry.go#L84
- [x] Node ID
- [x] Range ID
The end goal is to have some metrics we could look at to differentiate whether this is a slow consumer from the server side.
Jira issue: CRDB-50533
Contributor guide
Assessment
This issue has not been assessed yet.