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

feature request: VTGate support for retrieving GTIDs from shards #7400

Closed
gordonyoon opened this issue Jan 27, 2021 · 5 comments · Fixed by #7797 or #7856
Closed

feature request: VTGate support for retrieving GTIDs from shards #7400

gordonyoon opened this issue Jan 27, 2021 · 5 comments · Fixed by #7797 or #7856

Comments

@gordonyoon
Copy link

Feature Description

Expose a VTGate command that retrieves the GTID of a given shard.

Our current solution is to run the following commands:

SHOW vitess_shards;
for each:
  USE keyspace/shard;
  SELECT @@global.gtid_executed;

Use Case(s)

We have a query-cache system that relies on the VGTID passed through VStream. From the query-cache, we get the current GTID for a shard and apply messages from VStream based on the relative position of the VGTID to the one retrieved directly from VTGate.

@gordonyoon gordonyoon changed the title VTGate support for retrieving GTIDs from shards feature request: VTGate support for retrieving GTIDs from shards Jan 27, 2021
@gordonyoon
Copy link
Author

Queries to SHOW vitess_shards frequently returns the following error:

Code: UNKNOWN
vtgate: http://0765d3618921:15001/: keyspace names fetch error: interrupted: keyspaces

From Jacques:

The timeout for that query (when it hits the topology) is rather short; but the underlying problem is that those entries are cached for a very short amount of time by vtgate. We can boost the cache TTL; which will make it perform better in the general case. But the occasional timeout is still possible (but less likely/frequent as you up the TTL).

@harshit-gangal
Copy link
Member

This can be supported with a new query syntax
SHOW GLOBAL VGTID_EXECUTED - This will give VGTID from selected keyspace
SHOW GLOBAL VGTID_EXECUTED FROM <KEYSPACE> - This will give VGTID from provided keyspace

@gordonyoon
Copy link
Author

It would be great to also understand the availability of the command.

@harshit-gangal
Copy link
Member

@gordonyoon The command is as available as the cluster.

@harshit-gangal
Copy link
Member

harshit-gangal commented Apr 15, 2021

We have added 2 more commands

SHOW GLOBAL GTID_EXECUTED - This will give GTID from all shards in the selected keyspace
SHOW GLOBAL GTID_EXECUTED FROM <KEYSPACE>- This will give GTID from all shards in provided keyspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants