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
f266cdab
Commit
f266cdab
authored
Dec 01, 2003
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portability fixes (for binary build)
Added --protocol to mysqlbinlog
parent
3ee75849
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
41 deletions
+76
-41
client/mysql.cc
client/mysql.cc
+1
-1
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+20
-2
mysql-test/r/rpl_until.result
mysql-test/r/rpl_until.result
+3
-3
mysql-test/t/rpl_until.test
mysql-test/t/rpl_until.test
+3
-3
sql/mysqld.cc
sql/mysqld.cc
+47
-30
vio/viosocket.c
vio/viosocket.c
+2
-2
No files found.
client/mysql.cc
View file @
f266cdab
...
...
@@ -709,7 +709,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
break
;
}
break
;
break
;
case
'A'
:
rehash
=
0
;
break
;
...
...
client/mysqlbinlog.cc
View file @
f266cdab
...
...
@@ -34,6 +34,7 @@ ulong server_id = 0;
ulong
bytes_sent
=
0L
,
bytes_received
=
0L
;
ulong
mysqld_net_retry_count
=
10L
;
uint
test_flags
=
0
;
static
uint
opt_protocol
=
0
;
static
FILE
*
result_file
;
...
...
@@ -233,6 +234,10 @@ static struct my_option my_long_options[] =
{
"position"
,
'j'
,
"Start reading the binlog at position N."
,
(
gptr
*
)
&
position
,
(
gptr
*
)
&
position
,
0
,
GET_ULL
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"protocol"
,
OPT_MYSQL_PROTOCOL
,
"The protocol of connection (tcp,socket,pipe,memory)."
,
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"result-file"
,
'r'
,
"Direct output to a given file."
,
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"read-from-remote-server"
,
'R'
,
"Read binary logs from a MySQL server"
,
...
...
@@ -285,7 +290,7 @@ static void die(const char* fmt, ...)
static
void
print_version
()
{
printf
(
"%s Ver 2.
4
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
printf
(
"%s Ver 2.
5
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
}
...
...
@@ -369,6 +374,17 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case
'R'
:
remote_opt
=
1
;
break
;
case
OPT_MYSQL_PROTOCOL
:
{
if
((
opt_protocol
=
find_type
(
argument
,
&
sql_protocol_typelib
,
0
))
==
~
(
ulong
)
0
)
{
fprintf
(
stderr
,
"Unknown option to protocol: %s
\n
"
,
argument
);
exit
(
1
);
}
break
;
}
break
;
case
'V'
:
print_version
();
exit
(
0
);
...
...
@@ -398,9 +414,11 @@ static int parse_args(int *argc, char*** argv)
static
MYSQL
*
safe_connect
()
{
MYSQL
*
local_mysql
=
mysql_init
(
NULL
);
if
(
!
local_mysql
)
if
(
!
local_mysql
)
die
(
"Failed on mysql_init"
);
if
(
opt_protocol
)
mysql_options
(
local_mysql
,
MYSQL_OPT_PROTOCOL
,
(
char
*
)
&
opt_protocol
);
if
(
!
mysql_real_connect
(
local_mysql
,
host
,
user
,
pass
,
0
,
port
,
sock
,
0
))
die
(
"failed on connect: %s"
,
mysql_error
(
local_mysql
));
...
...
mysql-test/r/rpl_until.result
View file @
f266cdab
...
...
@@ -41,7 +41,7 @@ n
4
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244
649
Master master-no-such-bin.000001 291 No #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 244
#
Master master-no-such-bin.000001 291 No #
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
select * from t2;
n
...
...
@@ -49,13 +49,13 @@ n
2
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 449
649
Relay slave-relay-bin.000002 537 No #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 449
#
Relay slave-relay-bin.000002 537 No #
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=561;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561
693
Master master-bin.000001 561 No #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561
#
Master master-bin.000001 561 No #
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
...
...
mysql-test/t/rpl_until.test
View file @
f266cdab
...
...
@@ -38,7 +38,7 @@ start slave until master_log_file='master-no-such-bin.000001', master_log_pos=29
select
*
from
t1
;
sleep
2
;
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_column
1
# 9 # 33 #
--
replace_column
1
# 9 #
23 #
33 #
show
slave
status
;
# try replicate all until second insert to t2;
...
...
@@ -46,7 +46,7 @@ start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
sleep
2
;
select
*
from
t2
;
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_column
1
# 9 # 33 #
--
replace_column
1
# 9 #
23 #
33 #
show
slave
status
;
# clean up
...
...
@@ -62,7 +62,7 @@ start slave until master_log_file='master-bin.000001', master_log_pos=561;
sleep
2
;
# here the sql slave thread should be stopped
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_column
1
# 9 # 33 #
--
replace_column
1
# 9 #
23 #
33 #
show
slave
status
;
#testing various error conditions
...
...
sql/mysqld.cc
View file @
f266cdab
...
...
@@ -5785,63 +5785,80 @@ static void fix_paths(void)
*/
#ifdef SET_RLIMIT_NOFILE
#ifndef RLIM_INFINITY
#define RLIM_INFINITY ((uint) 0xffffffff)
#endif
static
uint
set_maximum_open_files
(
uint
max_file_limit
)
{
struct
rlimit
rlimit
;
ulong
old_cur
;
uint
old_cur
;
DBUG_ENTER
(
"set_maximum_open_files"
);
DBUG_PRINT
(
"enter"
,(
"files: %u"
,
max_file_limit
));
if
(
!
getrlimit
(
RLIMIT_NOFILE
,
&
rlimit
))
{
old_cur
=
rlimit
.
rlim_cur
;
if
(
rlimit
.
rlim_cur
>=
max_file_limit
)
// Nothing to do
return
rlimit
.
rlim_cur
;
/* purecov: inspected */
rlimit
.
rlim_cur
=
rlimit
.
rlim_max
=
max_file_limit
;
old_cur
=
(
uint
)
rlimit
.
rlim_cur
;
DBUG_PRINT
(
"info"
,
(
"rlim_cur: %u rlim_max: %u"
,
(
uint
)
rlimit
.
rlim_cur
,
(
uint
)
rlimit
.
rlim_max
));
if
(
rlimit
.
rlim_cur
>=
max_file_limit
||
rlimit
.
rlim_cur
==
RLIM_INFINITY
)
DBUG_RETURN
(
rlimit
.
rlim_cur
);
/* purecov: inspected */
rlimit
.
rlim_cur
=
rlimit
.
rlim_max
=
max_file_limit
;
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
rlimit
))
{
if
(
global_system_variables
.
log_warnings
)
sql_print_error
(
"Warning: setrlimit couldn't increase number of open files to more than %
l
u (request: %u)"
,
sql_print_error
(
"Warning: setrlimit couldn't increase number of open files to more than %u (request: %u)"
,
old_cur
,
max_file_limit
);
/* purecov: inspected */
max_file_limit
=
old_cur
;
max_file_limit
=
old_cur
;
}
else
{
rlimit
.
rlim_cur
=
0
;
// Safety if next call fails
(
void
)
getrlimit
(
RLIMIT_NOFILE
,
&
rlimit
);
if
((
uint
)
rlimit
.
rlim_cur
!=
max_file_limit
&&
DBUG_PRINT
(
"info"
,
(
"rlim_cur: %u"
,
(
uint
)
rlimit
.
rlim_cur
));
if
((
uint
)
rlimit
.
rlim_cur
<
max_file_limit
&&
global_system_variables
.
log_warnings
)
sql_print_error
(
"Warning: setrlimit returned ok, but didn't change limits. Max open files is %
ld
(request: %u)"
,
(
u
long
)
rlimit
.
rlim_cur
,
sql_print_error
(
"Warning: setrlimit returned ok, but didn't change limits. Max open files is %
u
(request: %u)"
,
(
u
int
)
rlimit
.
rlim_cur
,
max_file_limit
);
/* purecov: inspected */
max_file_limit
=
rlimit
.
rlim_cur
;
max_file_limit
=
(
uint
)
rlimit
.
rlim_cur
;
}
}
return
max_file_limit
;
DBUG_PRINT
(
"exit"
,(
"max_file_limit: %u"
,
max_file_limit
));
DBUG_RETURN
(
max_file_limit
);
}
#endif
#ifdef OS2
static
uint
set_maximum_open_files
(
uint
max_file_limit
)
{
LONG
cbReqCount
;
ULONG
cbCurMaxFH
,
cbCurMaxFH0
;
APIRET
ulrc
;
// get current limit
cbReqCount
=
0
;
DosSetRelMaxFH
(
&
cbReqCount
,
&
cbCurMaxFH0
);
// set new limit
cbReqCount
=
max_file_limit
-
cbCurMaxFH0
;
ulrc
=
DosSetRelMaxFH
(
&
cbReqCount
,
&
cbCurMaxFH
);
if
(
ulrc
)
{
sql_print_error
(
"Warning: DosSetRelMaxFH couldn't increase number of open files to more than %d"
,
cbCurMaxFH0
);
cbCurMaxFH
=
cbCurMaxFH0
;
}
return
cbCurMaxFH
;
LONG
cbReqCount
;
ULONG
cbCurMaxFH
,
cbCurMaxFH0
;
APIRET
ulrc
;
DBUG_ENTER
(
"set_maximum_open_files"
);
// get current limit
cbReqCount
=
0
;
DosSetRelMaxFH
(
&
cbReqCount
,
&
cbCurMaxFH0
);
// set new limit
cbReqCount
=
max_file_limit
-
cbCurMaxFH0
;
ulrc
=
DosSetRelMaxFH
(
&
cbReqCount
,
&
cbCurMaxFH
);
if
(
ulrc
)
{
sql_print_error
(
"Warning: DosSetRelMaxFH couldn't increase number of open files to more than %d"
,
cbCurMaxFH0
);
cbCurMaxFH
=
cbCurMaxFH0
;
}
DBUG_RETURN
(
cbCurMaxFH
);
}
#endif
/*
Return a bitfield from a string of substrings separated by ','
returns ~(ulong) 0 on error.
...
...
vio/viosocket.c
View file @
f266cdab
...
...
@@ -249,8 +249,8 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
}
else
{
size_socket
addrLen
=
sizeof
(
struct
sockaddr
);
if
(
getpeername
(
vio
->
sd
,
(
struct
sockaddr
*
)
(
&
(
vio
->
remote
)
),
size_socket
addrLen
=
sizeof
(
vio
->
remote
);
if
(
getpeername
(
vio
->
sd
,
(
struct
sockaddr
*
)
(
&
vio
->
remote
),
&
addrLen
)
!=
0
)
{
DBUG_PRINT
(
"exit"
,
(
"getpeername gave error: %d"
,
socket_errno
));
...
...
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