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
da0e28b7
Commit
da0e28b7
authored
May 13, 2003
by
guilhem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper replication of CONNECTION_ID() and 4.1 PASSWORD() (bugs 177 and 344),
new test for this.
parent
60dfb25b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
2 deletions
+70
-2
mysql-test/r/rpl_misc_functions.result
mysql-test/r/rpl_misc_functions.result
+21
-0
mysql-test/t/rpl_misc_functions-slave.sh
mysql-test/t/rpl_misc_functions-slave.sh
+1
-0
mysql-test/t/rpl_misc_functions.test
mysql-test/t/rpl_misc_functions.test
+30
-0
sql/item_create.cc
sql/item_create.cc
+6
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+12
-0
No files found.
mysql-test/r/rpl_misc_functions.result
0 → 100644
View file @
da0e28b7
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1(id int, i int, r1 int, r2 int, p varchar(100));
insert into t1 values(1, connection_id(), 0, 0, "");
insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
set sql_log_bin=0;
insert into t1 values(6, 0, rand(), rand(), "");
delete from t1 where id=6;
set sql_log_bin=1;
insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
select * into outfile 'rpl_misc_functions.outfile' from t1;
create table t2 like t1;
load data local infile './var/master-data/test/rpl_misc_functions.outfile' into table t2;
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
id i r1 r2 p id i r1 r2 p
stop slave;
mysql-test/t/rpl_misc_functions-slave.sh
0 → 100755
View file @
da0e28b7
rm
-f
$MYSQL_TEST_DIR
/var/master-data/test/rpl_misc_functions.outfile
mysql-test/t/rpl_misc_functions.test
0 → 100644
View file @
da0e28b7
#
# Test of replicating some difficult functions
#
source
include
/
master
-
slave
.
inc
;
create
table
t1
(
id
int
,
i
int
,
r1
int
,
r2
int
,
p
varchar
(
100
));
insert
into
t1
values
(
1
,
connection_id
(),
0
,
0
,
""
);
# don't put rand and password in the same query, to see if they replicate
# independently
# Pure rand test
insert
into
t1
values
(
2
,
0
,
rand
()
*
1000
,
rand
()
*
1000
,
""
);
# change the rand suite on the master (we do this because otherwise password()
# benefits from the fact that the above rand() is well replicated :
# it picks the same sequence element, which hides a possible bug in password() replication.
set
sql_log_bin
=
0
;
insert
into
t1
values
(
6
,
0
,
rand
(),
rand
(),
""
);
delete
from
t1
where
id
=
6
;
set
sql_log_bin
=
1
;
# Pure password test
insert
into
t1
values
(
3
,
0
,
0
,
0
,
password
(
'does_this_work?'
));
# "altogether now"
insert
into
t1
values
(
4
,
connection_id
(),
rand
()
*
1000
,
rand
()
*
1000
,
password
(
'does_this_still_work?'
));
select
*
into
outfile
'rpl_misc_functions.outfile'
from
t1
;
sync_slave_with_master
;
create
table
t2
like
t1
;
# read the values from the master table
load
data
local
infile
'./var/master-data/test/rpl_misc_functions.outfile'
into
table
t2
;
# compare them with the replica; the SELECT below should return no row
select
*
from
t1
,
t2
where
(
t1
.
id
=
t2
.
id
)
and
not
(
t1
.
i
=
t2
.
i
and
t1
.
r1
=
t2
.
r1
and
t1
.
r2
=
t2
.
r2
and
t1
.
p
=
t2
.
p
);
stop
slave
;
sql/item_create.cc
View file @
da0e28b7
...
...
@@ -84,8 +84,12 @@ Item *create_func_connection_id(void)
{
THD
*
thd
=
current_thd
;
thd
->
lex
.
safe_to_cache_query
=
0
;
return
new
Item_int
(
NullS
,(
longlong
)
thd
->
thread_id
,
10
);
}
return
new
Item_int
(
NullS
,(
longlong
)
((
thd
->
slave_thread
)
?
thd
->
variables
.
pseudo_thread_id
:
thd
->
thread_id
),
10
);
}
Item
*
create_func_conv
(
Item
*
a
,
Item
*
b
,
Item
*
c
)
{
...
...
sql/item_strfunc.cc
View file @
da0e28b7
...
...
@@ -1288,6 +1288,18 @@ String *Item_func_trim::val_str(String *str)
void
Item_func_password
::
fix_length_and_dec
()
{
/*
If PASSWORD() was called with only one argument, it depends on a random
number so we need to save this random number into the binary log.
If called with two arguments, it is repeatable.
*/
if
(
arg_count
==
1
)
{
THD
*
thd
=
current_thd
;
thd
->
rand_used
=
1
;
thd
->
rand_saved_seed1
=
thd
->
rand
.
seed1
;
thd
->
rand_saved_seed2
=
thd
->
rand
.
seed2
;
}
max_length
=
get_password_length
(
use_old_passwords
);
}
...
...
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