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
Basic GTID tracking. #77
Conversation
a1751b8
to
3ecce11
Compare
Hi Daniël, thanks for the pull request.
Maybe it is better to depend on if |
3ecce11
to
332a597
Compare
I used the version number from https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-first.html which is for the function, but not for SESSION_TRACK_GTIDS. I've now fixed the version number. Note that Connector/C 6.1.6 is not 5.6, but 5.7..
Changing this to check if SESSION_TRACK_GTIDS is defined might indeed be a better option. |
Hi! Please rebase your patches on top of master branch. Travis CI is now configured to test DBD::mysql with different MySQL & MariaDB versions. |
332a597
to
6e0915f
Compare
So... it does not compile with MariaDB client. |
6e0915f
to
274547c
Compare
dbdimp.c
Outdated
@@ -2854,6 +2854,24 @@ SV* dbd_db_FETCH_attrib(SV *dbh, imp_dbh_t *imp_dbh, SV *keysv) | |||
result= sv_2mortal((newRV_noinc((SV*)hv))); | |||
} | |||
|
|||
#if (MYSQL_VERSION_ID >= 50708) && (MYSQL_VERSION_ID <= MARIADB_VERSION_10) |
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.
If this feature is not supported by MariaDB client, then rather check that MARIADB_BASE_VERSION is not defined.
In future Oracle can decide that MySQL version could be increased to 10 or 11 and this code stop working.
12670fb
to
e323801
Compare
e323801
to
0d469d0
Compare
can we move this along? Any objections? |
What needs to be done to get this merged? |
This might be a slightly better example: #!/usr/bin/perl
use v5.24.0;
use DBI;
my $master_dbh = DBI->connect("DBI:mysql:database=test;host=mymaster", "myuser", "mypass");
my $slave_dbh = DBI->connect("DBI:mysql:database=test;host=myslave1", "myuser", "mypass");
# Write to the master
$master_dbh->do('SET SESSION session_track_gtids=OWN_GTID');
$master_dbh->do("INSERT INTO t1() VALUES()");
my $gtid = $master_dbh->{'mysql_gtids'};
$master_dbh->disconnect();
say "GTID= $gtid";
# Wait until the GTID hits the slave (or timeout)
my $sth = $slave_dbh->prepare("SELECT WAIT_FOR_EXECUTED_GTID_SET(?, 10)");
$sth->execute($gtid);
if ($sth->fetchrow_arrayref()->[0] != 0) {
say "Got timeout";
}
$sth->finish();
$slave_dbh->disconnect(); |
I merged this this morning - time to get a release going. |
https://rt.cpan.org/Public/Bug/Display.html?id=119122
https://dev.mysql.com/doc/refman/5.7/en/mysql-session-track-get-first.html
This code is only tested at a very basic level.
Example: