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
eb820aad
Commit
eb820aad
authored
Feb 12, 2008
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-rpl-merge
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
parents
01526671
9a4a38c4
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
295 additions
and
20 deletions
+295
-20
client/CMakeLists.txt
client/CMakeLists.txt
+2
-1
client/Makefile.am
client/Makefile.am
+2
-1
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+31
-7
client/mysqltest.c
client/mysqltest.c
+136
-1
configure.in
configure.in
+2
-2
mysql-test/r/binlog.result
mysql-test/r/binlog.result
+15
-0
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+3
-0
mysql-test/r/ps.result
mysql-test/r/ps.result
+16
-0
mysql-test/t/binlog.test
mysql-test/t/binlog.test
+17
-0
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+41
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+17
-0
sql/item.cc
sql/item.cc
+5
-1
sql/slave.cc
sql/slave.cc
+6
-5
sql/slave.h
sql/slave.h
+2
-2
No files found.
client/CMakeLists.txt
View file @
eb820aad
...
...
@@ -32,7 +32,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_EXECUTABLE
(
mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c
)
TARGET_LINK_LIBRARIES
(
mysql mysqlclient_notls wsock32
)
ADD_EXECUTABLE
(
mysqltest mysqltest.c ../mysys/my_getsystime.c ../mysys/my_copy.c
)
ADD_EXECUTABLE
(
mysqltest mysqltest.c ../mysys/my_getsystime.c
../mysys/my_copy.c ../mysys/my_mkdir.c
)
TARGET_LINK_LIBRARIES
(
mysqltest mysqlclient_notls regex wsock32
)
ADD_EXECUTABLE
(
mysqlcheck mysqlcheck.c
)
...
...
client/Makefile.am
View file @
eb820aad
...
...
@@ -34,7 +34,8 @@ mysqladmin_SOURCES = mysqladmin.cc
mysql_LDADD
=
@readline_link@ @TERMCAP_LIB@
$(LDADD)
$(CXXLDFLAGS)
mysqltest_SOURCES
=
mysqltest.c
\
$(top_srcdir)
/mysys/my_getsystime.c
\
$(top_srcdir)
/mysys/my_copy.c
$(top_srcdir)
/mysys/my_copy.c
\
$(top_srcdir)
/mysys/my_mkdir.c
mysqltest_LDADD
=
$(top_builddir)
/regex/libregex.a
$(LDADD)
mysqlbinlog_SOURCES
=
mysqlbinlog.cc
\
...
...
client/mysqlbinlog.cc
View file @
eb820aad
...
...
@@ -465,6 +465,31 @@ Create_file event for file_id: %u\n",ae->file_id);
Load_log_processor
load_processor
;
/**
Replace windows-style backslashes by forward slashes so it can be
consumed by the mysql client, which requires Unix path.
@todo This is only useful under windows, so may be ifdef'ed out on
other systems. /Sven
@todo If a Create_file_log_event contains a filename with a
backslash (valid under unix), then we have problems under windows.
/Sven
@param[in,out] fname Filename to modify. The filename is modified
in-place.
*/
static
void
convert_path_to_forward_slashes
(
char
*
fname
)
{
while
(
*
fname
)
{
if
(
*
fname
==
'\\'
)
*
fname
=
'/'
;
fname
++
;
}
}
static
bool
check_database
(
const
char
*
log_dbname
)
{
return
one_database
&&
...
...
@@ -582,6 +607,11 @@ int process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
*/
if
(
ce
)
{
/*
We must not convert earlier, since the file is used by
my_open() in Load_log_processor::append().
*/
convert_path_to_forward_slashes
((
char
*
)
ce
->
fname
);
ce
->
print
(
result_file
,
print_event_info
,
TRUE
);
my_free
((
char
*
)
ce
->
fname
,
MYF
(
MY_WME
));
delete
ce
;
...
...
@@ -622,13 +652,7 @@ Create_file event for file_id: %u\n",exv->file_id);
if
(
fname
)
{
/*
Fix the path so it can be consumed by mysql client (requires Unix path).
*/
int
stop
=
strlen
(
fname
);
for
(
int
i
=
0
;
i
<
stop
;
i
++
)
if
(
fname
[
i
]
==
'\\'
)
fname
[
i
]
=
'/'
;
convert_path_to_forward_slashes
(
fname
);
exlq
->
print
(
result_file
,
print_event_info
,
fname
);
my_free
(
fname
,
MYF
(
MY_WME
));
}
...
...
client/mysqltest.c
View file @
eb820aad
...
...
@@ -51,6 +51,10 @@
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef __WIN__
#include <direct.h>
#endif
#ifndef WEXITSTATUS
# ifdef __WIN__
...
...
@@ -277,7 +281,7 @@ enum enum_commands {
Q_REPLACE_REGEX
,
Q_REMOVE_FILE
,
Q_FILE_EXIST
,
Q_WRITE_FILE
,
Q_COPY_FILE
,
Q_PERL
,
Q_DIE
,
Q_EXIT
,
Q_SKIP
,
Q_CHMOD_FILE
,
Q_APPEND_FILE
,
Q_CAT_FILE
,
Q_DIFF_FILES
,
Q_SEND_QUIT
,
Q_SEND_QUIT
,
Q_CHANGE_USER
,
Q_MKDIR
,
Q_RMDIR
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
...
...
@@ -366,6 +370,10 @@ const char *command_names[]=
"cat_file"
,
"diff_files"
,
"send_quit"
,
"change_user"
,
"mkdir"
,
"rmdir"
,
0
};
...
...
@@ -2741,6 +2749,67 @@ void do_file_exist(struct st_command *command)
}
/*
SYNOPSIS
do_mkdir
command called command
DESCRIPTION
mkdir <dir_name>
Create the directory <dir_name>
*/
void
do_mkdir
(
struct
st_command
*
command
)
{
int
error
;
static
DYNAMIC_STRING
ds_dirname
;
const
struct
command_arg
mkdir_args
[]
=
{
"dirname"
,
ARG_STRING
,
TRUE
,
&
ds_dirname
,
"Directory to create"
};
DBUG_ENTER
(
"do_mkdir"
);
check_command_args
(
command
,
command
->
first_argument
,
mkdir_args
,
sizeof
(
mkdir_args
)
/
sizeof
(
struct
command_arg
),
' '
);
DBUG_PRINT
(
"info"
,
(
"creating directory: %s"
,
ds_dirname
.
str
));
error
=
my_mkdir
(
ds_dirname
.
str
,
0777
,
MYF
(
0
))
!=
0
;
handle_command_error
(
command
,
error
);
dynstr_free
(
&
ds_dirname
);
DBUG_VOID_RETURN
;
}
/*
SYNOPSIS
do_rmdir
command called command
DESCRIPTION
rmdir <dir_name>
Remove the empty directory <dir_name>
*/
void
do_rmdir
(
struct
st_command
*
command
)
{
int
error
;
static
DYNAMIC_STRING
ds_dirname
;
const
struct
command_arg
rmdir_args
[]
=
{
"dirname"
,
ARG_STRING
,
TRUE
,
&
ds_dirname
,
"Directory to remove"
};
DBUG_ENTER
(
"do_rmdir"
);
check_command_args
(
command
,
command
->
first_argument
,
rmdir_args
,
sizeof
(
rmdir_args
)
/
sizeof
(
struct
command_arg
),
' '
);
DBUG_PRINT
(
"info"
,
(
"removing directory: %s"
,
ds_dirname
.
str
));
error
=
rmdir
(
ds_dirname
.
str
)
!=
0
;
handle_command_error
(
command
,
error
);
dynstr_free
(
&
ds_dirname
);
DBUG_VOID_RETURN
;
}
/*
Read characters from line buffer or file. This is needed to allow
my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file
...
...
@@ -3046,6 +3115,69 @@ void do_send_quit(struct st_command *command)
}
/*
SYNOPSIS
do_change_user
command called command
DESCRIPTION
change_user [<user>], [<passwd>], [<db>]
<user> - user to change to
<passwd> - user password
<db> - default database
Changes the user and causes the database specified by db to become
the default (current) database for the the current connection.
*/
void
do_change_user
(
struct
st_command
*
command
)
{
MYSQL
*
mysql
=
&
cur_con
->
mysql
;
/* static keyword to make the NetWare compiler happy. */
static
DYNAMIC_STRING
ds_user
,
ds_passwd
,
ds_db
;
const
struct
command_arg
change_user_args
[]
=
{
{
"user"
,
ARG_STRING
,
FALSE
,
&
ds_user
,
"User to connect as"
},
{
"password"
,
ARG_STRING
,
FALSE
,
&
ds_passwd
,
"Password used when connecting"
},
{
"database"
,
ARG_STRING
,
FALSE
,
&
ds_db
,
"Database to select after connect"
},
};
DBUG_ENTER
(
"do_change_user"
);
check_command_args
(
command
,
command
->
first_argument
,
change_user_args
,
sizeof
(
change_user_args
)
/
sizeof
(
struct
command_arg
),
','
);
if
(
cur_con
->
stmt
)
{
mysql_stmt_close
(
cur_con
->
stmt
);
cur_con
->
stmt
=
NULL
;
}
if
(
!
ds_user
.
length
)
dynstr_set
(
&
ds_user
,
mysql
->
user
);
if
(
!
ds_passwd
.
length
)
dynstr_set
(
&
ds_passwd
,
mysql
->
passwd
);
if
(
!
ds_db
.
length
)
dynstr_set
(
&
ds_db
,
mysql
->
db
);
DBUG_PRINT
(
"info"
,(
"connection: '%s' user: '%s' password: '%s' database: '%s'"
,
cur_con
->
name
,
ds_user
.
str
,
ds_passwd
.
str
,
ds_db
.
str
));
if
(
mysql_change_user
(
mysql
,
ds_user
.
str
,
ds_passwd
.
str
,
ds_db
.
str
))
die
(
"change user failed: %s"
,
mysql_error
(
mysql
));
dynstr_free
(
&
ds_user
);
dynstr_free
(
&
ds_passwd
);
dynstr_free
(
&
ds_db
);
DBUG_VOID_RETURN
;
}
/*
SYNOPSIS
do_perl
...
...
@@ -6847,11 +6979,14 @@ int main(int argc, char **argv)
case
Q_ECHO
:
do_echo
(
command
);
command_executed
++
;
break
;
case
Q_SYSTEM
:
do_system
(
command
);
break
;
case
Q_REMOVE_FILE
:
do_remove_file
(
command
);
break
;
case
Q_MKDIR
:
do_mkdir
(
command
);
break
;
case
Q_RMDIR
:
do_rmdir
(
command
);
break
;
case
Q_FILE_EXIST
:
do_file_exist
(
command
);
break
;
case
Q_WRITE_FILE
:
do_write_file
(
command
);
break
;
case
Q_APPEND_FILE
:
do_append_file
(
command
);
break
;
case
Q_DIFF_FILES
:
do_diff_files
(
command
);
break
;
case
Q_SEND_QUIT
:
do_send_quit
(
command
);
break
;
case
Q_CHANGE_USER
:
do_change_user
(
command
);
break
;
case
Q_CAT_FILE
:
do_cat_file
(
command
);
break
;
case
Q_COPY_FILE
:
do_copy_file
(
command
);
break
;
case
Q_CHMOD_FILE
:
do_chmod_file
(
command
);
break
;
...
...
configure.in
View file @
eb820aad
...
...
@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE
(
mysql, 5.0.5
6
)
AM_INIT_AUTOMAKE
(
mysql, 5.0.5
8
)
AM_CONFIG_HEADER
([
include/config.h:config.h.in]
)
PROTOCOL_VERSION
=
10
...
...
@@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR
=
5
NDB_VERSION_MINOR
=
0
NDB_VERSION_BUILD
=
5
6
NDB_VERSION_BUILD
=
5
8
NDB_VERSION_STATUS
=
""
# Set all version vars based on $VERSION. How do we do this more elegant ?
...
...
mysql-test/r/binlog.result
View file @
eb820aad
...
...
@@ -567,4 +567,19 @@ master-bin.000001 36585 Rotate 1 36629 master-bin.000002;pos=4
drop table t1;
set global binlog_cache_size=@bcs;
set session autocommit = @ac;
drop table if exists t1;
reset master;
create table t1 (a bigint unsigned, b bigint(20) unsigned);
prepare stmt from "insert into t1 values (?,?)";
set @a= 9999999999999999;
set @b= 14632475938453979136;
execute stmt using @a, @b;
deallocate prepare stmt;
drop table t1;
show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 98 Server version, Binlog ver: 4
master-bin.000001 98 Query 1 219 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
master-bin.000001 219 Query 1 343 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
master-bin.000001 343 Query 1 419 use `test`; drop table t1
End of 5.0 tests
mysql-test/r/mysqltest.result
View file @
eb820aad
...
...
@@ -722,4 +722,7 @@ a int(11) YES NULL
b varchar(255) YES NULL
c datetime YES NULL
drop table t1;
mysqltest: At line 1: change user failed: Unknown database 'inexistent'
mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
End of tests
mysql-test/r/ps.result
View file @
eb820aad
...
...
@@ -1693,4 +1693,20 @@ t1 CREATE TABLE `t1` (
`?` decimal(2,1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
drop table if exists t1;
create table t1 (a bigint unsigned, b bigint(20) unsigned);
prepare stmt from "insert into t1 values (?,?)";
set @a= 9999999999999999;
set @b= 14632475938453979136;
insert into t1 values (@a, @b);
select * from t1 where a = @a and b = @b;
a b
9999999999999999 14632475938453979136
execute stmt using @a, @b;
select * from t1 where a = @a and b = @b;
a b
9999999999999999 14632475938453979136
9999999999999999 14632475938453979136
deallocate prepare stmt;
drop table t1;
End of 5.0 tests.
mysql-test/t/binlog.test
View file @
eb820aad
...
...
@@ -106,4 +106,21 @@ drop table t1;
set
global
binlog_cache_size
=@
bcs
;
set
session
autocommit
=
@
ac
;
#
# Bug#33798: prepared statements improperly handle large unsigned ints
#
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
reset
master
;
create
table
t1
(
a
bigint
unsigned
,
b
bigint
(
20
)
unsigned
);
prepare
stmt
from
"insert into t1 values (?,?)"
;
set
@
a
=
9999999999999999
;
set
@
b
=
14632475938453979136
;
execute
stmt
using
@
a
,
@
b
;
deallocate
prepare
stmt
;
drop
table
t1
;
--
replace_regex
/
\
/
\
*
xid
=.*
\
*
\
//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
show
binlog
events
from
0
;
--
echo
End
of
5.0
tests
mysql-test/t/mysqltest.test
View file @
eb820aad
...
...
@@ -2083,5 +2083,46 @@ eval $show_statement;
drop
table
t1
;
# ----------------------------------------------------------------------------
# Test change_user command
# ----------------------------------------------------------------------------
--
error
1
--
exec
echo
"--change_user root,,inexistent"
|
$MYSQL_TEST
2
>&
1
--
error
1
--
exec
echo
"--change_user inexistent,,test"
|
$MYSQL_TEST
2
>&
1
--
error
1
--
exec
echo
"--change_user root,inexistent,test"
|
$MYSQL_TEST
2
>&
1
--
change_user
--
change_user
root
--
change_user
root
,,
--
change_user
root
,,
test
# ----------------------------------------------------------------------------
# Test mkdir and rmdir command
# ----------------------------------------------------------------------------
mkdir
$MYSQLTEST_VARDIR
/
tmp
/
testdir
;
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
testdir
;
# Directory already exist
mkdir
$MYSQLTEST_VARDIR
/
tmp
/
testdir
;
--
error
1
mkdir
$MYSQLTEST_VARDIR
/
tmp
/
testdir
;
# Remove dir with file inside
write_file
$MYSQLTEST_VARDIR
/
tmp
/
testdir
/
file1
.
txt
;
hello
EOF
--
error
1
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
testdir
;
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
testdir
/
file1
.
txt
;
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
testdir
;
--
echo
End
of
tests
mysql-test/t/ps.test
View file @
eb820aad
...
...
@@ -1807,4 +1807,21 @@ execute stmt using @a;
show
create
table
t1
;
drop
table
t1
;
#
# Bug#33798: prepared statements improperly handle large unsigned ints
#
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
create
table
t1
(
a
bigint
unsigned
,
b
bigint
(
20
)
unsigned
);
prepare
stmt
from
"insert into t1 values (?,?)"
;
set
@
a
=
9999999999999999
;
set
@
b
=
14632475938453979136
;
insert
into
t1
values
(
@
a
,
@
b
);
select
*
from
t1
where
a
=
@
a
and
b
=
@
b
;
execute
stmt
using
@
a
,
@
b
;
select
*
from
t1
where
a
=
@
a
and
b
=
@
b
;
deallocate
prepare
stmt
;
drop
table
t1
;
--
echo
End
of
5.0
tests
.
sql/item.cc
View file @
eb820aad
...
...
@@ -2580,6 +2580,7 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry)
if
(
entry
&&
entry
->
value
)
{
item_result_type
=
entry
->
type
;
unsigned_flag
=
entry
->
unsigned_flag
;
if
(
strict_type
&&
required_result_type
!=
item_result_type
)
DBUG_RETURN
(
1
);
switch
(
item_result_type
)
{
...
...
@@ -2875,7 +2876,10 @@ const String *Item_param::query_val_str(String* str) const
{
switch
(
state
)
{
case
INT_VALUE
:
str
->
set
(
value
.
integer
,
&
my_charset_bin
);
if
(
unsigned_flag
)
str
->
set
((
ulonglong
)
value
.
integer
,
&
my_charset_bin
);
else
str
->
set
(
value
.
integer
,
&
my_charset_bin
);
break
;
case
REAL_VALUE
:
str
->
set
(
value
.
real
,
NOT_FIXED_DEC
,
&
my_charset_bin
);
...
...
sql/slave.cc
View file @
eb820aad
...
...
@@ -2447,14 +2447,15 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
protocol
->
prepare_for_resend
();
/*
TODO: we read slave_running without run_lock, whereas these variables
are updated under run_lock and not data_lock. In 5.0 we should lock
run_lock on top of data_lock (with good order).
slave_running can be accessed without run_lock but not other
non-volotile members like mi->io_thd, which is guarded by the mutex.
*/
pthread_mutex_lock
(
&
mi
->
run_lock
);
protocol
->
store
(
mi
->
io_thd
?
mi
->
io_thd
->
proc_info
:
""
,
&
my_charset_bin
);
pthread_mutex_unlock
(
&
mi
->
run_lock
);
pthread_mutex_lock
(
&
mi
->
data_lock
);
pthread_mutex_lock
(
&
mi
->
rli
.
data_lock
);
protocol
->
store
(
mi
->
io_thd
?
mi
->
io_thd
->
proc_info
:
""
,
&
my_charset_bin
);
protocol
->
store
(
mi
->
host
,
&
my_charset_bin
);
protocol
->
store
(
mi
->
user
,
&
my_charset_bin
);
protocol
->
store
((
uint32
)
mi
->
port
);
...
...
sql/slave.h
View file @
eb820aad
...
...
@@ -65,8 +65,8 @@
mi->rli does not either.
In MASTER_INFO: run_lock, data_lock
run_lock protects all information about the run state: slave_running,
and the
existence of the I/O thread (
to stop/start it, you need this mutex).
run_lock protects all information about the run state: slave_running,
thd
and the existence of the I/O thread
to stop/start it, you need this mutex).
data_lock protects some moving members of the struct: counters (log name,
position) and relay log (MYSQL_LOG object).
...
...
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