| 7740 | |
| 7741 | |
| 7742 | void MYSQL_BIN_LOG::xlock(void) |
| 7743 | { |
| 7744 | mysql_mutex_lock(&LOCK_log); |
| 7745 | |
| 7746 | DBUG_ASSERT(!snapshot_lock_acquired); |
| 7747 | |
| 7748 | /* |
| 7749 | We must ensure that no writes to binlog and no commits to storage engines |
| 7750 | occur after function is called for START TRANSACTION FOR CONSISTENT |
| 7751 | SNAPSHOT. With binlog_order_commits=1 (the default) flushing to binlog is |
| 7752 | performed under the LOCK_log mutex and commits are done under the |
| 7753 | LOCK_commit mutex, both in the stage leader thread. So acquiring those 2 |
| 7754 | mutexes is sufficient to guarantee atomicity. |
| 7755 | |
| 7756 | With binlog_order_commits=0 commits are performed in parallel by separate |
| 7757 | threads with each acquiring a shared lock on LOCK_consistent_snapshot. |
| 7758 | |
| 7759 | binlog_order_commits is a dynamic variable, so we have to keep track what |
| 7760 | primitives should be used in xunlock(). |
| 7761 | */ |
| 7762 | if (opt_binlog_order_commits) |
| 7763 | { |
| 7764 | mysql_mutex_lock(&LOCK_commit); |
| 7765 | } |
| 7766 | else |
| 7767 | { |
| 7768 | snapshot_lock_acquired= true; |
| 7769 | mysql_rwlock_wrlock(&LOCK_consistent_snapshot); |
| 7770 | } |
| 7771 | } |
| 7772 | |
| 7773 | |
| 7774 | void MYSQL_BIN_LOG::xunlock(void) |
nothing calls this directly
no outgoing calls
no test coverage detected