DBZ-5572: Specify table.include.list during VStream subscription #96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When table.include.list was used to only subscribe to changes to a subset of tables in the database, the filtering is currently done in debezium VM. This is less efficient comparing to the filtering at the VtTablet level. During VStream subscription, you can specify which tables you are interested, the VtTable will only send the changes to these tables to you. The benefit of doing filtering in VtTable level is:
The fix is relatively straightforward by using Binlogdata.Filter during VStreamRequest building. The details of those filters can be found in: https://github.com/vitessio/vitess/blob/release-14.0/go/vt/vttablet/tabletserver/vstreamer/planbuilder.go#L316 . Note that when you provide the table name for the filtering, you also need to provide a SELECT query to further restrict the rows/columns from that table, we are currently not filtering on row/column level.
New integration tests are added to cover the table.include.list filtering.
The change only applies when you specify table.include.list config params.
For reference, sometimes we saw the errors not related to our tables like below:
Errors like the following (that _ghc table is the temp table created during gh-ost migration process)
VStream streaming onError. Status: Status{code=UNKNOWN, description=target: byuser.-4000.replica: vttablet: rpc error: code = Unknown desc = stream (at source tablet) error @ 08fb1cf3-0ce5-11ed-b921-0a8939501751:1-1443715: unknown table _mentions_unread_ghc in schema, cause=null}