Bug #77784 Redundant code in THD::reset_for_next_command()
Submitted: 20 Jul 2015 14:25 Modified: 26 Aug 2015 13:45
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Connection Handling Severity:S3 (Non-critical)
Version:5.5, 5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any

[20 Jul 2015 14:25] Alexey Kopytov
Description:
There's the following code at the end of THD::reset_for_next_command():

---
  thd->m_trans_end_pos= 0;
  thd->m_trans_log_file= NULL;
  thd->m_trans_fixed_log_file= NULL;
  thd->commit_error= THD::CE_NONE;
  thd->durability_property= HA_REGULAR_DURABILITY;
  thd->set_trans_pos(NULL, 0);
---

The first 3 lines reset the binary log position of the current transaction. But that is also precisely what the following call to thd->set_trans_pos(NULL, 0) achieves: it resets m_trans_end_pos to 0 and both m_trans_log_file and m_trans_fixed_log_file to NULL, making those 3 assignments redundant.

How to repeat:
Read the mentioned part of code.
[20 Jul 2015 18:15] Sinisa Milivojevic
Indeed, there is a redundant code as described.
[26 Aug 2015 13:45] Paul Dubois
Fixed in 5.6.27, 5.7.9, 5.8.0 changelogs.

Code cleanup. No changelog entry needed.