Skip to content

Commit

Permalink
fix code style..
Browse files Browse the repository at this point in the history
  • Loading branch information
vinchen authored and knielsen committed Oct 19, 2016
1 parent c334f4f commit 0fa39ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sql/net_serv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ my_net_read_packet(NET *net, my_bool read_from_server)
}
net->read_pos = net->buff + net->where_b;
if (len != packet_error)
{
{
net->read_pos[len]=0; /* Safeguard for mysql_use_result */
net->real_network_read_len = len;
}
Expand Down
12 changes: 7 additions & 5 deletions sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4482,7 +4482,8 @@ Stopping slave I/O thread due to out-of-memory error from master");
/* Control the binlog read speed of master when read_binlog_speed_limit is non-zero
*/
ulonglong read_binlog_speed_limit_in_bytes = opt_read_binlog_speed_limit * 1024;
if (read_binlog_speed_limit_in_bytes) {
if (read_binlog_speed_limit_in_bytes)
{
/* prevent the tokenamount become a large value,
for example, the IO thread doesn't work for a long time
*/
Expand All @@ -4492,21 +4493,22 @@ Stopping slave I/O thread due to out-of-memory error from master");
tokenamount = read_binlog_speed_limit_in_bytes * 2;
}

do{
do
{
ulonglong currenttime = my_hrtime().val;
tokenamount += (currenttime - lastchecktime)*read_binlog_speed_limit_in_bytes/(1000*1000);
tokenamount += (currenttime - lastchecktime) * read_binlog_speed_limit_in_bytes / (1000*1000);
lastchecktime = currenttime;
if(tokenamount < network_read_len)
{
ulonglong micro_sleeptime = 1000*1000*(network_read_len - tokenamount) / read_binlog_speed_limit_in_bytes ;
ulonglong micro_sleeptime = 1000*1000 * (network_read_len - tokenamount) / read_binlog_speed_limit_in_bytes ;
my_sleep(micro_sleeptime > 1000 ? micro_sleeptime : 1000); // at least sleep 1000 micro second
}
}while(tokenamount < network_read_len);
tokenamount -= network_read_len;
}

/* XXX: 'synced' should be updated by queue_event to indicate
whether event has been synced to disk */
whether event has been synced to disk */
bool synced= 0;
if (queue_event(mi, event_buf, event_len))
{
Expand Down

0 comments on commit 0fa39ff

Please sign in to comment.