Skip to content

Commit 7e57c81

Browse files
author
Paweł Andruszkiewicz
committed
BUG#37216767 The maxRate dump option may not limit the throughput
The `Rate_limit m_rate_limit` variable used by the dumper to throttle the dump was initialized when the dump started. If there was a time gap between start of the dump and start of the data dump (i.e. when there was a lot of data that needed to be chunked), the throttling would be off and dump was not throttled for some period of time. As a fix, the scope of `Rate_limit` variable is now limited to the `dump_table_data()` method, meaning the information required to throttle the transfer is collected only when data is dumped. Change-Id: I3391f4b9eec7b00b0a2d23c2766a4d0e7a299b7b
1 parent a949eda commit 7e57c81

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

modules/util/dump/dumper.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,6 @@ class Dumper::Table_worker final {
727727

728728
open_session();
729729

730-
m_rate_limit =
731-
mysqlshdk::utils::Rate_limit(m_dumper->m_options.max_rate());
732-
733730
while (true) {
734731
auto work = m_dumper->m_worker_tasks.pop();
735732

@@ -845,6 +842,7 @@ class Dumper::Table_worker final {
845842
const auto controller = table.controller.get();
846843

847844
try {
845+
mysqlshdk::utils::Rate_limit rate_limit{m_dumper->m_options.max_rate()};
848846
const auto result = query(full_query);
849847

850848
controller->start_writing(result->get_metadata(), pre_encoded_columns);
@@ -862,8 +860,8 @@ class Dumper::Table_worker final {
862860

863861
// we don't know how much data was read from the server, number of
864862
// bytes written to the dump file is a good approximation
865-
if (m_rate_limit.enabled()) {
866-
m_rate_limit.throttle(controller->progress_stats().data_bytes());
863+
if (rate_limit.enabled()) {
864+
rate_limit.throttle(controller->progress_stats().data_bytes());
867865
}
868866

869867
controller->reset_progress();
@@ -1661,7 +1659,6 @@ class Dumper::Table_worker final {
16611659
const std::string m_log_id;
16621660
Dumper *m_dumper;
16631661
Exception_strategy m_strategy;
1664-
mysqlshdk::utils::Rate_limit m_rate_limit;
16651662
std::shared_ptr<mysqlshdk::db::ISession> m_session;
16661663
};
16671664

0 commit comments

Comments
 (0)