Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c334f4fe
Commit
c334f4fe
authored
Oct 17, 2016
by
vinchen
Committed by
Kristian Nielsen
Oct 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the code style for read_binlog_speed_limit
parent
ef77847c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
97 deletions
+66
-97
include/my_sys.h
include/my_sys.h
+0
-1
mysys/my_getsystime.c
mysys/my_getsystime.c
+0
-31
sql/net_serv.cc
sql/net_serv.cc
+57
-56
sql/slave.cc
sql/slave.cc
+9
-9
No files found.
include/my_sys.h
View file @
c334f4fe
...
...
@@ -939,7 +939,6 @@ void my_time_init(void);
extern
my_hrtime_t
my_hrtime
(
void
);
extern
ulonglong
my_interval_timer
(
void
);
extern
ulonglong
my_getcputime
(
void
);
extern
ulonglong
my_micro_time
();
#define microsecond_interval_timer() (my_interval_timer()/1000)
#define hrtime_to_time(X) ((X).val/HRTIME_RESOLUTION)
...
...
mysys/my_getsystime.c
View file @
c334f4fe
...
...
@@ -131,34 +131,3 @@ ulonglong my_getcputime()
#endif
/* CLOCK_THREAD_CPUTIME_ID */
return
0
;
}
/**
Return time in microseconds.
@remark This function is to be used to measure performance in
micro seconds. As it's not defined whats the start time
for the clock, this function us only useful to measure
time between two moments.
@retval Value in microseconds from some undefined point in time.
*/
ulonglong
my_micro_time
()
{
#ifdef _WIN32
ulonglong
newtime
;
GetSystemTimeAsFileTime
((
FILETIME
*
)
&
newtime
);
newtime
-=
OFFSET_TO_EPOC
;
return
(
newtime
/
10
);
#else
ulonglong
newtime
;
struct
timeval
t
;
/*
The following loop is here because gettimeofday may fail on some systems
*/
while
(
gettimeofday
(
&
t
,
NULL
)
!=
0
)
{}
newtime
=
(
ulonglong
)
t
.
tv_sec
*
1000000
+
t
.
tv_usec
;
return
newtime
;
#endif
}
sql/net_serv.cc
View file @
c334f4fe
...
...
@@ -1164,7 +1164,8 @@ my_net_read_packet(NET *net, my_bool read_from_server)
net
->
where_b
=
save_pos
;
}
net
->
read_pos
=
net
->
buff
+
net
->
where_b
;
if
(
len
!=
packet_error
)
{
if
(
len
!=
packet_error
)
{
net
->
read_pos
[
len
]
=
0
;
/* Safeguard for mysql_use_result */
net
->
real_network_read_len
=
len
;
}
...
...
sql/slave.cc
View file @
c334f4fe
...
...
@@ -4419,7 +4419,7 @@ pthread_handler_t handle_slave_io(void *arg)
mi
->
slave_running
=
MYSQL_SLAVE_RUN_READING
;
DBUG_ASSERT
(
mi
->
last_error
().
number
==
0
);
ulonglong
lastchecktime
=
my_
micro_time
()
/
1000
;
ulonglong
lastchecktime
=
my_
hrtime
().
val
;
ulonglong
tokenamount
=
opt_read_binlog_speed_limit
*
1024
;
while
(
!
io_slave_killed
(
mi
))
{
...
...
@@ -4481,24 +4481,24 @@ 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
=
opt_read_binlog_speed_limit
;
if
(
read_binlog_speed_limit
)
{
ulonglong
read_binlog_speed_limit
_in_bytes
=
opt_read_binlog_speed_limit
*
1024
;
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
*/
if
(
tokenamount
>
read_binlog_speed_limit
*
1024
*
2
)
if
(
tokenamount
>
read_binlog_speed_limit
_in_bytes
*
2
)
{
lastchecktime
=
my_
micro_time
()
/
1000
;
tokenamount
=
read_binlog_speed_limit
*
1024
*
2
;
lastchecktime
=
my_
hrtime
().
val
;
tokenamount
=
read_binlog_speed_limit
_in_bytes
*
2
;
}
do
{
ulonglong
currenttime
=
my_
micro_time
()
/
1000
;
tokenamount
+=
(
currenttime
-
lastchecktime
)
*
read_binlog_speed_limit
*
1024
/
1000
;
ulonglong
currenttime
=
my_
hrtime
().
val
;
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
*
1024
)
;
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment