-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
VStream API: allow keyspace-level heartbeats to be streamed #16593
VStream API: allow keyspace-level heartbeats to be streamed #16593
Conversation
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
…l tables Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
68863d4
to
731799a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16593 +/- ##
==========================================
+ Coverage 68.85% 68.98% +0.12%
==========================================
Files 1557 1562 +5
Lines 199891 200776 +885
==========================================
+ Hits 137644 138505 +861
- Misses 62247 62271 +24 ☔ View full report in Codecov by Sentry. |
…nes and the ones specified separately Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
@@ -1171,7 +1171,7 @@ func (tsv *TabletServer) VStream(ctx context.Context, request *binlogdatapb.VStr | |||
if err := tsv.sm.VerifyTarget(ctx, request.Target); err != nil { | |||
return err | |||
} | |||
return tsv.vstreamer.Stream(ctx, request.Position, request.TableLastPKs, request.Filter, throttlerapp.VStreamerName, send) | |||
return tsv.vstreamer.Stream(ctx, request.Position, request.TableLastPKs, request.Filter, throttlerapp.VStreamerName, send, request.Options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding vstream options to support a variadic set of options (0-N) like we recently did for lock options and (workflow) server options? Then we don't need to pass this as nil in so many places: https://github.com/vitessio/vitess/blob/main/go/vt/vtctl/workflow/server_options.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using strong typing unless functionally contraindicated. Especially for a grpc API.
While updating all usages can be tedious, it also helps review the parts of code where that API is being called: #16593 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I only had some minor comments. Let me know what you think and I'll come back to this quickly.
func TestInternalTables(t *testing.T) { | ||
func TestOnlineDDLTables(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a clue that it might be better to explicitly call these sidecar[db]_tables
rather than internal_tables
. Although they're all internal tables so it's also fine as-is IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I was also vacillating between internal
and sidecar(db)
. internal
is not precise because we could also term online ddl shadow tables and other artifacts as internal. I will let @deepthi also weigh in before changing it everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have been resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deepthi, the question was a broader one. Currently we use options/proto attributes like InternalTables
, is_internal
. Should we change that to SidecarDBTables
and is_sidecardb_table
?
We could either continue calling it Internal (keeping it generic, allowing for future specification of other tables than SidecarDB tables, like, I don't know, shadow tables in OnlineDDL for example) or lock it down to SidecarDB tables using that in the object naming instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal
is fine for now. Renaming proto fields is not difficult if we wanted to change it in the future.
@@ -398,6 +398,79 @@ func TestMissingTables(t *testing.T) { | |||
runCases(t, filter, testcases, startPos, nil) | |||
} | |||
|
|||
// TestInternalTables tests streaming of sidecar db tables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment for the function name is another clue that it might be better/clearer to call them SidecarDBTables rather than InternalTables.
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
func TestInternalTables(t *testing.T) { | ||
func TestOnlineDDLTables(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have been resolved.
@@ -73,5 +73,5 @@ func (c *ReplicaConnector) Close() error { | |||
} | |||
|
|||
func (c *ReplicaConnector) VStream(ctx context.Context, startPos string, filter *binlogdatapb.Filter, send func([]*binlogdatapb.VEvent) error) error { | |||
return c.vstreamer.Stream(ctx, startPos, nil, filter, throttlerapp.ReplicaConnectorName, send) | |||
return c.vstreamer.Stream(ctx, startPos, nil, filter, throttlerapp.ReplicaConnectorName, send, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again, based on how this is being used (only in PITR), we don't pass in the options.
Is it possible to replace usages of this connector with the tabletConnector?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to replace usages of this connector with the tabletConnector?
I think so. Should be a separate PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should even think about deleting all the binlog server code in the existing PITR implementation. No one is using it.
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @rohit-nayak-ps ! ❤️
Description
This PR adds an option to the VTGate VStream API to allow heartbeats created by vttablet's heartbeat writer to be streamed as regular FieldEvents/RowEvents for the sidecar
_vt.heartbeat
table.Note that the vttablet heartbeats have to be enabled either through the throttler (which is on by default) or explicitly turning on the heartbeats using, for example,
--heartbeat_enable
,--heartbeat_interval 1s
and--heartbeat_on_demand_duration 0
Related Issue(s)
Checklist