Michael Widenius <monty@askmonty.org> writes:
knielsen> +++ b/sql/log.cc 2010-10-04 10:48:08 +0000 knielsen> @@ -6531,6 +6531,39 @@ err1: knielsen> "--tc-heuristic-recover={commit|rollback}"); knielsen> return 1; knielsen> } knielsen> + knielsen> +static TC_LOG * knielsen> +tc_log_mmap_register(void *arg __attribute__((unused)), int yield) knielsen> +{ knielsen> + if (yield || total_ha_2pc <= 1) knielsen> + return NULL; knielsen> + knielsen> + return &tc_log_mmap; knielsen> +}
<cut>
knielsen> +++ b/sql/mysqld.cc 2010-10-04 10:48:08 +0000 knielsen> @@ -4283,10 +4283,11 @@ a file name for --log-bin-index option", knielsen> } knielsen> #endif
knielsen> - tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? knielsen> - (TC_LOG *) &mysql_bin_log : knielsen> - (TC_LOG *) &tc_log_mmap) : knielsen> - (TC_LOG *) &tc_log_dummy);
According to the old code, the tc_log_mmap_register() should use:
if (yield || total_ha_2pc <= 1 || opt_bin_log) return NULL;
Was this an intentional change ?
It is not a behavior change. If opt_bin_log is set, then in the first round (yield==true), the mmap plugin will yield, and the binlog plugin will select itself as TC. If opt_bin_log is not set, then binlog plugin will not register as TC and mmap (or dummy) will register themselves as fallback TC in the second round (yield==false). The idea is to generalise the test to handle the case of a custom binlog plugin, in which case a hard-coded check of opt_bin_log is not sufficient.
If yes, there should have been a comment about it.
Thanks for your remarks, I will try to clarify the comments. - Kristian.