Excessive and unneccessary current_thd usage in Percona Server

Bug #1121794 reported by Alexey Kopytov on 2013-02-11
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Alexey Kopytov
Won't Fix
Fix Released
Alexey Kopytov

Bug Description

A call to _current_thd() is expensive, and some Percona patches use
current_thd unnecessarily, sometimes on critical code paths.

For example, benchmarks show that removing the following _current_thd()
call in innobase_commit_low() introduced by
innodb_overwrite_relay_log_info increased sysbench point select
high-concurrency results by about 1k tps:

 if (trx_is_started(trx)) {

  /* Save the current replication position for write to trx sys
  header for undo purposes, see the comment at corresponding call
  at innobase_xa_prepare(). */

  innobase_copy_repl_coords_to_trx(current_thd, trx);


The THD pointer is available in trx->mysql_thd, there's no need to use
current_thd there.

A quick inspection of the code shows there are many more unnecessary
current_thd occurrences in our code. Some of them are trivial to fix, while
others may require re-architecting certain features.

Related branches

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-633

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

Other bug subscribers