Skip to content
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

vtgate keyspace filtering using -tablet_filters should apply to the vschema as well #4378

Closed
demmer opened this issue Nov 20, 2018 · 0 comments

Comments

@demmer
Copy link
Member

demmer commented Nov 20, 2018

Overview

Extend the -tablet_filters feature to filter keyspaces from the SrvVschema before passing to the executor.

Details

To isolate different workloads, we want to configure vtgates to only access certain keyspaces. The existing -tablet_filters feature works for this at the discovery / query routing layer but all the keyspace definitions are still present in the SrvVschema.

This presents a problem for the current handling of dual table query routing since it is pinned to route to the first keyspace in the list alphabetically, but that one may not be visible to the given vtgate.

Furthermore, the various introspection commands like show databases erroneously show keyspaces that should be hidden from the vtgate consumers.

To address this we should update the VschemaManager to pay attention to keyspace filters configured and to remove the filtered keyspaces from the list before passing the Vschema to the Executor.

This should solve both of these issues.

setassociative added a commit to tinyspeck/vitess that referenced this issue Dec 4, 2018
### Summary
This was added in order to support spining up a vtgate within a cell that
has a limited access to the keyspaces inside that cell. It was added instead
of modifying the existing `filter_tablets` behavior because bringing in the
`|<shard-or-keyrange>` syntax didn't make sense based on the desired behavior.
`filter_tablets` and `keyspaces_to_watch` were made mutually exclusive to
prevent situations where the flags required different keyspaces which would
have implied a non-obvious behavior (or had to fail anyway).

Implementation was relatively straight-forward: I added a new srvtopo.Server
that can filter the keyspaces returned and passed to the callback for
WatchSrvVSchema as well as tests. If a call is made to get the underlying
topo.Server is returned, e.g., calls to a server Conn's ListDir will not be
have any filtering applied.

### Testing

Automated: Unit tests for the new filtering `srvtopo.Server` impl

Manual:

Using the vagrant setup I spun up a cluster with:

2 keyspaces: aaa_keyspace, test_keyspace
10 vttablets: 5 fronting each keyspace
1 vtgate, 1vtctld

- when not watching a specific keyspace showed both keyspaces on `show vitess_keyspaces`
- when `keyspaces_to_watch=test_keyspace` was set only `test_keyspace` was returned for `show vitess_keyspaces`; `select now() from dual;` was functional

Signed-off-by: Richard Bailey <[email protected]>
setassociative added a commit to tinyspeck/vitess that referenced this issue Dec 7, 2018
demmer added a commit that referenced this issue Dec 14, 2018
…pace-filtering

[closes #4378] Add keyspace visibility filtering to vtgates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant