| Bug #72954 | unnecessary memcpy in de_queue() when event is applied | ||
|---|---|---|---|
| Submitted: | 11 Jun 2014 9:54 | Modified: | 29 Nov 2018 14:52 |
| Reporter: | liu hickey (OCA) | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Row Based Replication ( RBR ) | Severity: | S3 (Non-critical) |
| Version: | 5.6.16+/5.7.4+ | OS: | Any |
| Assigned to: | MySQL Verification Team | CPU Architecture: | Any |
| Tags: | de_queue, memcpy, parallel replication, slave | ||
[12 Jun 2014 6:06]
qinglin zhang
I check de_queue in slave_worker_exec_job and confirm the problem, any one else has pay attention to it?
[29 Nov 2018 14:52]
MySQL Verification Team
Hi, Thanks for your report. Closing as it is unrelated to any modern release. kind regards Bogdan

Description: In slave_worker_exec_job(), dispatched jobs are fetch from job queue, applied, and then move forward for the entry. For the last step, there are some problems: de_queue(&worker->jobs, job_item) -> get_dynamic(&jobs->Q, (uchar*) ret, jobs->entry) -> memcpy While the passed in argument - job_item - is filled but not used, caused unnecessary overhead for each applied event. How to repeat: code reading Suggested fix: $ git diff diff --git a/sql/rpl_rli_pdb.cc b/sql/rpl_rli_pdb.cc index ae1c795..a479e41 100644 --- a/sql/rpl_rli_pdb.cc +++ b/sql/rpl_rli_pdb.cc @@ -1689,7 +1689,9 @@ Slave_job_item * de_queue(Slave_jobs_queue *jobs, Slave_job_item *ret) DBUG_ASSERT(jobs->len == 0); return NULL; } - get_dynamic(&jobs->Q, (uchar*) ret, jobs->entry); + + if (ret) + get_dynamic(&jobs->Q, (uchar*) ret, jobs->entry); jobs->len--; // pre boundary cond @@ -2003,7 +2005,7 @@ int slave_worker_exec_job(Slave_worker *worker, Relay_log_info *rli) } mysql_mutex_lock(&worker->jobs_lock); - de_queue(&worker->jobs, job_item); + de_queue(&worker->jobs, NULL); /* possible overfill */ if (worker->jobs.len == worker->jobs.size - 1 && worker->jobs.overfill == TRUE)