I establish the master-slave replication based on GTID. And i want to get the newest GTID of master or slave, I know the way of getting GTID by show variables like '%gtid%', but this way requires constant timed query. Is there any way about mariadb server can active notice if I provide a script or a function.
if I provide a script or a function,Mmariadb server can active notice the newest GTID
Neither MariaDB nor MySQL can send data to clients without a previous request from the client.
Tracking the GTID is supported by several client connectors (like MariaDB Connector/C or MariaDB Connector/Python) where the GTID will be obtainted from the session state information of the OK packet from previous commit.
Here is a simple example in Python:
Result/Output: