Kristian Nielsen <email@example.com>
to Rich, me
Rich Prohaska <firstname.lastname@example.org> writes:
> MariaDB's optimistic parallel replication uses a new MySQL API (something
> like THD_report_wait_for) to notify the optimistic scheduler that a lock
> conflict was encountered. In addition, it uses a handlerton api (something
> like kill_query) to cause the storage engine to wakeup any waiting client
> threads. These changes are not included in the push request as I thought
> that they were specific to MariaDB. However, I have not been following the
> algorithms being used in MySQL replication (especially 5.7 and 8.0), so
> maybe they have something similar.
The kill_query handlerton API is standard and has been in both MySQL and
MariaDB for a long time. It would make sense to include it in TokuDB for
Percona Server, it should work the same as in MariaDB without modifications.
This allows a user to use KILL QUERY to interrupt a query that is waiting
for a row lock.
The thd_report_wait_for API is specific to MariaDB and optimistic parallel
replication. So it will go in under #ifdef MARIADB_BASE_VERSION, and will
not directly benefit Percona Server.
MySQL 5.7 does have something similar to thd_report_wait_for(). It is called
thd_report_row_lock_wait(), and actually is an identical API (except for the
function name) to the MariaDB thd_report_wait_for(), as seen from the
However, MySQL 5.7 does not have optimistic replication, nor the ability to
break engine row locks in case of conflict. The thd_report_row_lock_wait()
only sets a flag that is used by the MySQL replication manager at the end of
commit, to handle a few InnoDB corner cases. From my limited knowledge of
the MySQL replication code, there would not be a benefit for TokuDB to
implement the MySQL 5.7 thd_report_row_lock_wait() API currently.
I do not know what the policy is for TokuDB to upstream MariaDB-specific
code like what Rich mentions. From my side, we can upstream it, or I can
maintain it separately in MariaDB, either way works fine for me. The changes
are minor, anyway, after Rich's fixes to the locktree code.
Hope this helps,