Skip to content

Commit 439c5c7

Browse files
author
Libing Song
committed
BUG#26362562 COMMIT_ORDER_MANAGER INSTRUMENTATION IS INCOMPLETE
Description =========== mysql_mutex_destroy was not called in ~Commit_order_manager. It caused a memory leak in debug build after WL#9764. Fix === Both mysql_mutex_destroy and mysql_cond_destroy are called to destroy the mutex and condition objects in ~Commit_order_manager.
1 parent cf3a1d4 commit 439c5c7

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

sql/rpl_slave_commit_order_manager.cc

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,16 @@ Commit_order_manager::Commit_order_manager(uint32 worker_numbers)
2929
}
3030
}
3131

32+
Commit_order_manager::~Commit_order_manager()
33+
{
34+
mysql_mutex_destroy(&m_mutex);
35+
36+
for (uint32 i= 0; i < m_workers.size(); i++)
37+
{
38+
mysql_cond_destroy(&m_workers[i].cond);
39+
}
40+
}
41+
3242
void Commit_order_manager::register_trx(Slave_worker *worker)
3343
{
3444
DBUG_ENTER("Commit_order_manager::register_trx");

sql/rpl_slave_commit_order_manager.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ class Commit_order_manager
2626
{
2727
public:
2828
Commit_order_manager(uint32 worker_numbers);
29-
~Commit_order_manager() {}
29+
~Commit_order_manager();
3030

3131
/**
3232
Register the worker into commit order queue when coordinator dispatches a
@@ -124,6 +124,10 @@ class Commit_order_manager
124124
}
125125

126126
uint32 queue_front() { return queue_head; }
127+
128+
// Copy constructor is not implemented
129+
Commit_order_manager(const Commit_order_manager&);
130+
Commit_order_manager& operator=(const Commit_order_manager&);
127131
};
128132

129133
inline bool has_commit_order_manager(THD *thd)

0 commit comments

Comments
 (0)