percona server 5.7 super_read_only and gtid_executed table

Bug #1683812 reported by Maxim Fedotov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
New
Undecided
Unassigned

Bug Description

Suppose that you have percona server 5.7 slave with super_read_only option enabled.
thread/sql/compress_gtid_table will be stuck always rollbacking on commit.

This is due to following change in handler.cc file.
In percona-server 5.7:
  if (rw_trans && !ignore_global_read_lock)
1780 {
1781 /*
1782 Acquire a metadata lock which will ensure that COMMIT is blocked
1783 by an active FLUSH TABLES WITH READ LOCK (and vice versa:
1784 COMMIT in progress blocks FTWRL).
1785
1786 We allow the owner of FTWRL to COMMIT; we assume that it knows
1787 what it does.
1788 */
1789 MDL_REQUEST_INIT(&mdl_request,
1790 MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
1791 MDL_EXPLICIT);
1792

1793 DBUG_PRINT("debug", ("Acquire MDL commit lock"));
1794 if (thd->mdl_context.acquire_lock(&mdl_request,
1795 thd->variables.lock_wait_timeout))
1796 {
1797 ha_rollback_trans(thd, all);
1798 DBUG_RETURN(1);
1799 }
1800 release_mdl= true;
1801

1802 DEBUG_SYNC(thd, "ha_commit_trans_after_acquire_commit_lock");
1803 }
1804

1805 if (rw_trans && stmt_has_updated_trans_table(ha_info)
1806 && check_readonly(thd, true))
1807 {
1808 ha_rollback_trans(thd, all);
1809 error= 1;
1810 goto end;
1811 }

in mysql 5.7:
 if (rw_trans && !ignore_global_read_lock)
1747 {
1748 /*
1749 Acquire a metadata lock which will ensure that COMMIT is blocked
1750 by an active FLUSH TABLES WITH READ LOCK (and vice versa:
1751 COMMIT in progress blocks FTWRL).
1752
1753 We allow the owner of FTWRL to COMMIT; we assume that it knows
1754 what it does.
1755 */
1756 MDL_REQUEST_INIT(&mdl_request,
1757 MDL_key::COMMIT, "", "", MDL_INTENTION_EXCLUSIVE,
1758 MDL_EXPLICIT);
1759

1760 DBUG_PRINT("debug", ("Acquire MDL commit lock"));
1761 if (thd->mdl_context.acquire_lock(&mdl_request,
1762 thd->variables.lock_wait_timeout))
1763 {
1764 ha_rollback_trans(thd, all);
1765 DBUG_RETURN(1);
1766 }
1767 release_mdl= true;
1768

1769 DEBUG_SYNC(thd, "ha_commit_trans_after_acquire_commit_lock");
1770

1771 if (stmt_has_updated_trans_table(ha_info) && check_readonly(thd, true))
1772 {
1773 ha_rollback_trans(thd, all);
1774 error= 1;
1775 goto end;
1776 }
1777 }

The problem is in this:
   if (rw_trans && stmt_has_updated_trans_table(ha_info)
1806 && check_readonly(thd, true))
1807 {
1808 ha_rollback_trans(thd, all);
1809 error= 1;
1810 goto end;
1811 }

it should be inside if (rw_trans && !ignore_global_read_lock) condition.

This bug causes huge growth of gtid_executed tables and severe IO, because due to stuck thread a lot of IO is generated to iblog files.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

This is bug 1654682 (http://bugs.mysql.com/bug.php?id=84437), already fixed in Percona Server 5.7.17-12. Closing as duplicate - please re-open if needed

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.