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
5f164e2f
Commit
5f164e2f
authored
Sep 23, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into narttu.mysql.fi:/my/mysql-4.0
parents
f05a1c83
ef8cd361
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
134 additions
and
96 deletions
+134
-96
client/mysql.cc
client/mysql.cc
+4
-2
client/mysqlbinlog.cc
client/mysqlbinlog.cc
+26
-9
extra/comp_err.c
extra/comp_err.c
+1
-1
heap/hp_test2.c
heap/hp_test2.c
+2
-2
include/my_global.h
include/my_global.h
+10
-0
isam/test2.c
isam/test2.c
+2
-2
myisam/mi_test2.c
myisam/mi_test2.c
+2
-2
mysql-test/r/distinct.result
mysql-test/r/distinct.result
+5
-5
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+7
-7
mysql-test/r/rpl000009.result
mysql-test/r/rpl000009.result
+0
-12
mysql-test/t/rpl000009.test
mysql-test/t/rpl000009.test
+10
-8
mysys/default.c
mysys/default.c
+8
-0
sql/des_key_file.cc
sql/des_key_file.cc
+4
-4
sql/item_strfunc.cc
sql/item_strfunc.cc
+17
-17
sql/mysql_priv.h
sql/mysql_priv.h
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+33
-22
support-files/mysql.server.sh
support-files/mysql.server.sh
+1
-1
No files found.
client/mysql.cc
View file @
5f164e2f
...
...
@@ -40,7 +40,7 @@
#include <signal.h>
#include <violite.h>
const
char
*
VER
=
"12.2
1
"
;
const
char
*
VER
=
"12.2
2
"
;
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
...
...
@@ -801,7 +801,9 @@ static int read_lines(bool execute_commands)
char
*
prompt
=
(
char
*
)
(
glob_buffer
.
is_empty
()
?
construct_prompt
()
:
!
in_string
?
" -> "
:
in_string
==
'\''
?
" '> "
:
"
\"
> "
);
" '> "
:
(
in_string
==
'`'
?
" `> "
:
"
\"
> "
));
if
(
opt_outfile
&&
glob_buffer
.
is_empty
())
fflush
(
OUTFILE
);
...
...
client/mysqlbinlog.cc
View file @
5f164e2f
...
...
@@ -21,6 +21,7 @@
#include <assert.h>
#include "log_event.h"
#include "include/my_sys.h"
#include "unistd.h"
#define BIN_LOG_HEADER_SIZE 4
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4)
...
...
@@ -81,9 +82,9 @@ class Load_log_processor
bname
--
;
uint
blen
=
ce
->
fname_len
-
(
bname
-
ce
->
fname
);
uint
full_len
=
target_dir_name_len
+
blen
;
uint
full_len
=
target_dir_name_len
+
blen
+
9
+
9
+
1
;
char
*
tmp
;
if
(
!
(
tmp
=
my_malloc
(
full_len
+
9
+
1
,
MYF
(
MY_WME
)))
||
if
(
!
(
tmp
=
my_malloc
(
full_len
,
MYF
(
MY_WME
)))
||
set_dynamic
(
&
file_names
,(
gptr
)
&
ce
,
ce
->
file_id
))
{
die
(
"Could not construct local filename %s%s"
,
target_dir_name
,
bname
);
...
...
@@ -96,6 +97,21 @@ class Load_log_processor
memcpy
(
ptr
,
bname
,
blen
);
ptr
+=
blen
;
sprintf
(
ptr
,
"-%08x"
,
ce
->
file_id
);
ptr
+=
9
;
uint
version
=
0
;
for
(;;)
{
sprintf
(
ptr
,
"-%08x"
,
version
);
if
(
access
(
tmp
,
F_OK
))
break
;
version
++
;
if
(
version
>
UINT_MAX
)
{
die
(
"Could not construct local filename %s%s"
,
target_dir_name
,
bname
);
return
0
;
}
}
ce
->
set_fname_outside_temp_buf
(
tmp
,
full_len
);
...
...
@@ -169,6 +185,8 @@ class Load_log_processor
}
Create_file_log_event
*
grab_event
(
uint
file_id
)
{
if
(
file_id
>=
file_names
.
elements
)
return
0
;
Create_file_log_event
**
ptr
=
(
Create_file_log_event
**
)
file_names
.
buffer
+
file_id
;
Create_file_log_event
*
res
=
*
ptr
;
...
...
@@ -182,8 +200,12 @@ class Load_log_processor
}
void
process
(
Append_block_log_event
*
ae
)
{
if
(
ae
->
file_id
>=
file_names
.
elements
)
{
Create_file_log_event
*
ce
=
(
ae
->
file_id
<
file_names
.
elements
)
?
*
((
Create_file_log_event
**
)
file_names
.
buffer
+
ae
->
file_id
)
:
0
;
if
(
ce
)
append_to_file
(
ce
->
fname
,
O_APPEND
|
O_BINARY
|
O_WRONLY
,
ae
->
block
,
ae
->
block_len
);
else
/*
There is no Create_file event (a bad binlog or a big
--position). Assuming it's a big --position, we just do nothing and
...
...
@@ -191,11 +213,6 @@ class Load_log_processor
*/
fprintf
(
stderr
,
"Warning: ignoring Append_block as there is no \
Create_file event for file_id: %u
\n
"
,
ae
->
file_id
);
return
;
}
Create_file_log_event
*
ce
=
*
((
Create_file_log_event
**
)
file_names
.
buffer
+
ae
->
file_id
);
append_to_file
(
ce
->
fname
,
O_APPEND
|
O_BINARY
|
O_WRONLY
,
ae
->
block
,
ae
->
block_len
);
}
};
...
...
extra/comp_err.c
View file @
5f164e2f
...
...
@@ -109,7 +109,7 @@ int main(int argc,char *argv[])
if
(
to
)
fclose
(
to
);
if
(
error
)
fprintf
(
stderr
,
"Can't up
p
date messagefile %s, errno: %d
\n
"
,
*
argv
,
errno
);
fprintf
(
stderr
,
"Can't update messagefile %s, errno: %d
\n
"
,
*
argv
,
errno
);
exit
(
error
);
return
(
0
);
...
...
heap/hp_test2.c
View file @
5f164e2f
...
...
@@ -237,12 +237,12 @@ int main(int argc, char *argv[])
{
if
(
my_errno
!=
HA_ERR_FOUND_DUPP_KEY
||
key3
[
n3
]
==
0
)
{
printf
(
"error: %d; can't up
p
date:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
printf
(
"error: %d; can't update:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
my_errno
,
record
,
record2
);
goto
err
;
}
if
(
verbose
)
printf
(
"Double key when tr
yed to up
pdate:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
record
,
record2
);
printf
(
"Double key when tr
ied to u
pdate:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
record
,
record2
);
}
else
{
...
...
include/my_global.h
View file @
5f164e2f
...
...
@@ -1105,4 +1105,14 @@ typedef union {
#define statistic_add(V,C,L) (V)+=(C)
#endif
#ifdef HAVE_OPENSSL
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x0090700f
#define DES_cblock des_cblock
#define DES_key_schedule des_key_schedule
#define DES_set_key_unchecked(k,ks) des_set_key_unchecked((k),*(ks))
#define DES_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e) des_ede3_cbc_encrypt((i),(o),(l),*(k1),*(k2),*(k3),(iv),(e))
#endif
#endif
#endif
/* my_global_h */
isam/test2.c
View file @
5f164e2f
...
...
@@ -265,12 +265,12 @@ int main(int argc, char *argv[])
{
if
(
my_errno
!=
HA_ERR_FOUND_DUPP_KEY
||
key3
[
n3
]
==
0
)
{
printf
(
"error: %d; can't up
p
date:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
printf
(
"error: %d; can't update:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
my_errno
,
read_record
,
record2
);
goto
err
;
}
if
(
verbose
)
printf
(
"Double key when tr
yed to up
pdate:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
record
,
record2
);
printf
(
"Double key when tr
ied to u
pdate:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
record
,
record2
);
}
else
{
...
...
myisam/mi_test2.c
View file @
5f164e2f
...
...
@@ -329,12 +329,12 @@ int main(int argc, char *argv[])
{
if
(
my_errno
!=
HA_ERR_FOUND_DUPP_KEY
||
key3
[
n3
]
==
0
)
{
printf
(
"error: %d; can't up
p
date:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
printf
(
"error: %d; can't update:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
my_errno
,
read_record
,
record2
);
goto
err
;
}
if
(
verbose
)
printf
(
"Double key when tr
yed to up
pdate:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
record
,
record2
);
printf
(
"Double key when tr
ied to u
pdate:
\n
From:
\"
%s
\"\n
To:
\"
%s
\"\n
"
,
record
,
record2
);
}
else
{
...
...
mysql-test/r/distinct.result
View file @
5f164e2f
...
...
@@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3);
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
table type possible_keys key key_len ref rows Extra
t
2 index a a 4 NULL 5
Using index; Using temporary
t
1 eq_ref PRIMARY PRIMARY 4 t2.a 1
t
3 index a a 5 NULL 5 Using where; Using index
t
3 index a a 5 NULL 6
Using index; Using temporary
t
2 index a a 4 NULL 5 Using index; Distinct
t
1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
...
...
@@ -303,9 +303,9 @@ t1 index id id 4 NULL 2 Using index; Using temporary
t2 index id id 8 NULL 1 Using index; Distinct
t3 index id id 8 NULL 1 Using index; Distinct
j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
t2_lj
index id id 8 NULL
1 Using where; Using index; Distinct
t2_lj
ref id id 4 j_lj_t2.id
1 Using where; Using index; Distinct
j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
t3_lj
index id id 8 NULL
1 Using where; Using index; Distinct
t3_lj
ref id id 4 j_lj_t3.id
1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
...
...
mysql-test/r/order_by.result
View file @
5f164e2f
...
...
@@ -307,17 +307,17 @@ table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 8 Using where; Using index
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL
4
Using where; Using index
t1 range a a 9 NULL
5
Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL
5
Using where; Using index
t1 range a a 9 NULL
6
Using where; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL
4
Using where; Using index
t1 range a a 9 NULL
5
Using where; Using index
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 2 Using where; Using index
...
...
@@ -466,8 +466,8 @@ t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
table type possible_keys key key_len ref rows Extra
t
1 index PRIMARY PRIMARY 4 NULL 6 Using index
t
3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
t
3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
t
1 eq_ref PRIMARY PRIMARY 4 t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
...
...
@@ -475,8 +475,8 @@ t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
table type possible_keys key key_len ref rows Extra
t
1 index PRIMARY PRIMARY 4 NULL 6 Using index;
Using temporary; Using filesort
t
3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
t
3 ALL PRIMARY NULL NULL NULL 6
Using temporary; Using filesort
t
1 eq_ref PRIMARY PRIMARY 4 t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
...
...
mysql-test/r/rpl000009.result
View file @
5f164e2f
...
...
@@ -111,22 +111,10 @@ n s
2 two bar
3 three bar
4 four bar
insert into bar.t1 values(10, 'should be there');
flush tables;
load data from master;
Error on delete of './bar/t1.MYI' (Errcode: 13)
select * from bar.t1;
n s
1 one bar
2 two bar
3 three bar
4 four bar
10 should be there
load table bar.t1 from master;
Table 't1' already exists
drop table bar.t1;
load table bar.t1 from master;
start slave;
drop database bar;
drop database foo;
drop database foo;
...
...
mysql-test/t/rpl000009.test
View file @
5f164e2f
...
...
@@ -110,13 +110,14 @@ select * from bar.t1;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten.
insert
into
bar
.
t1
values
(
10
,
'should be there'
);
flush
tables
;
system
chmod
500
var
/
slave
-
data
/
bar
/
;
--
error
6
load
data
from
master
;
# should fail (errno 13)
system
chmod
700
var
/
slave
-
data
/
bar
/
;
select
*
from
bar
.
t1
;
# should contain the row (10, ...)
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
# insert into bar.t1 values(10, 'should be there');
# flush tables;
# system chmod 500 var/slave-data/bar/;
# --error 6
# load data from master; # should fail (errno 13)
# system chmod 700 var/slave-data/bar/;
# select * from bar.t1; # should contain the row (10, ...)
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
...
...
@@ -126,7 +127,8 @@ drop table bar.t1;
load
table
bar
.
t1
from
master
;
# as LOAD DATA FROM MASTER failed it did not restart slave threads
start
slave
;
# DISABLED FOR NOW
# start slave;
# Now time for cleanup
connection
master
;
...
...
mysys/default.c
View file @
5f164e2f
...
...
@@ -387,6 +387,8 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
*
ptr
++=
'='
;
for
(
;
value
!=
value_end
;
value
++
)
{
if
(
*
value
==
'\"'
||
*
value
==
'\''
)
continue
;
if
(
*
value
==
'\\'
&&
value
!=
value_end
-
1
)
{
switch
(
*++
value
)
{
...
...
@@ -405,6 +407,12 @@ static int search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
case
's'
:
*
ptr
++=
' '
;
/* space */
break
;
case
'\"'
:
*
ptr
++=
'\"'
;
break
;
case
'\''
:
*
ptr
++=
'\''
;
break
;
case
'\\'
:
*
ptr
++=
'\\'
;
break
;
...
...
sql/des_key_file.cc
View file @
5f164e2f
...
...
@@ -76,16 +76,16 @@ load_des_key_file(const char *file_name)
if
(
start
!=
end
)
{
des
_cblock
ivec
;
DES
_cblock
ivec
;
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
// We make good 24-byte (168 bit) key from given plaintext key with MD5
EVP_BytesToKey
(
EVP_des_ede3_cbc
(),
EVP_md5
(),
NULL
,
(
uchar
*
)
start
,
(
int
)
(
end
-
start
),
1
,
(
uchar
*
)
&
keyblock
,
ivec
);
des_set_key_unchecked
(
&
keyblock
.
key1
,
des_keyschedule
[(
int
)
offset
].
ks1
);
des_set_key_unchecked
(
&
keyblock
.
key2
,
des_keyschedule
[(
int
)
offset
].
ks2
);
des_set_key_unchecked
(
&
keyblock
.
key3
,
des_keyschedule
[(
int
)
offset
].
ks3
);
DES_set_key_unchecked
(
&
keyblock
.
key1
,
&
(
des_keyschedule
[(
int
)
offset
].
ks1
)
);
DES_set_key_unchecked
(
&
keyblock
.
key2
,
&
(
des_keyschedule
[(
int
)
offset
].
ks2
)
);
DES_set_key_unchecked
(
&
keyblock
.
key3
,
&
(
des_keyschedule
[(
int
)
offset
].
ks3
)
);
if
(
des_default_key
==
15
)
des_default_key
=
(
uint
)
offset
;
// use first as def.
}
...
...
sql/item_strfunc.cc
View file @
5f164e2f
...
...
@@ -330,7 +330,7 @@ void Item_func_concat::fix_length_and_dec()
String
*
Item_func_des_encrypt
::
val_str
(
String
*
str
)
{
#ifdef HAVE_OPENSSL
des
_cblock
ivec
;
DES
_cblock
ivec
;
struct
st_des_keyblock
keyblock
;
struct
st_des_keyschedule
keyschedule
;
const
char
*
append_str
=
"********"
;
...
...
@@ -370,9 +370,9 @@ String *Item_func_des_encrypt::val_str(String *str)
EVP_BytesToKey
(
EVP_des_ede3_cbc
(),
EVP_md5
(),
NULL
,
(
uchar
*
)
keystr
->
ptr
(),
(
int
)
keystr
->
length
(),
1
,
(
uchar
*
)
&
keyblock
,
ivec
);
des_set_key_unchecked
(
&
keyblock
.
key1
,
keyschedule
.
ks1
);
des_set_key_unchecked
(
&
keyblock
.
key2
,
keyschedule
.
ks2
);
des_set_key_unchecked
(
&
keyblock
.
key3
,
keyschedule
.
ks3
);
DES_set_key_unchecked
(
&
keyblock
.
key1
,
&
keyschedule
.
ks1
);
DES_set_key_unchecked
(
&
keyblock
.
key2
,
&
keyschedule
.
ks2
);
DES_set_key_unchecked
(
&
keyblock
.
key3
,
&
keyschedule
.
ks3
);
}
/*
...
...
@@ -393,12 +393,12 @@ String *Item_func_des_encrypt::val_str(String *str)
tmp_value
[
0
]
=
(
char
)
(
128
|
key_number
);
// Real encryption
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
des
_ede3_cbc_encrypt
((
const
uchar
*
)
(
res
->
ptr
()),
DES
_ede3_cbc_encrypt
((
const
uchar
*
)
(
res
->
ptr
()),
(
uchar
*
)
(
tmp_value
.
ptr
()
+
1
),
res_length
,
keyschedule
.
ks1
,
keyschedule
.
ks2
,
keyschedule
.
ks3
,
&
keyschedule
.
ks1
,
&
keyschedule
.
ks2
,
&
keyschedule
.
ks3
,
&
ivec
,
TRUE
);
return
&
tmp_value
;
...
...
@@ -412,8 +412,8 @@ String *Item_func_des_encrypt::val_str(String *str)
String
*
Item_func_des_decrypt
::
val_str
(
String
*
str
)
{
#ifdef HAVE_OPENSSL
des
_key_schedule
ks1
,
ks2
,
ks3
;
des
_cblock
ivec
;
DES
_key_schedule
ks1
,
ks2
,
ks3
;
DES
_cblock
ivec
;
struct
st_des_keyblock
keyblock
;
struct
st_des_keyschedule
keyschedule
;
String
*
res
=
args
[
0
]
->
val_str
(
str
);
...
...
@@ -447,20 +447,20 @@ String *Item_func_des_decrypt::val_str(String *str)
(
uchar
*
)
keystr
->
ptr
(),(
int
)
keystr
->
length
(),
1
,(
uchar
*
)
&
keyblock
,
ivec
);
// Here we set all 64-bit keys (56 effective) one by one
des_set_key_unchecked
(
&
keyblock
.
key1
,
keyschedule
.
ks1
);
des_set_key_unchecked
(
&
keyblock
.
key2
,
keyschedule
.
ks2
);
des_set_key_unchecked
(
&
keyblock
.
key3
,
keyschedule
.
ks3
);
DES_set_key_unchecked
(
&
keyblock
.
key1
,
&
keyschedule
.
ks1
);
DES_set_key_unchecked
(
&
keyblock
.
key2
,
&
keyschedule
.
ks2
);
DES_set_key_unchecked
(
&
keyblock
.
key3
,
&
keyschedule
.
ks3
);
}
if
(
tmp_value
.
alloc
(
length
-
1
))
goto
error
;
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
des
_ede3_cbc_encrypt
((
const
uchar
*
)
res
->
ptr
()
+
1
,
DES
_ede3_cbc_encrypt
((
const
uchar
*
)
res
->
ptr
()
+
1
,
(
uchar
*
)
(
tmp_value
.
ptr
()),
length
-
1
,
keyschedule
.
ks1
,
keyschedule
.
ks2
,
keyschedule
.
ks3
,
&
keyschedule
.
ks1
,
&
keyschedule
.
ks2
,
&
keyschedule
.
ks3
,
&
ivec
,
FALSE
);
/* Restore old length of key */
if
((
tail
=
(
uint
)
(
uchar
)
tmp_value
[
length
-
2
])
>
8
)
...
...
sql/mysql_priv.h
View file @
5f164e2f
...
...
@@ -474,11 +474,11 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
#include <openssl/des.h>
struct
st_des_keyblock
{
des
_cblock
key1
,
key2
,
key3
;
DES
_cblock
key1
,
key2
,
key3
;
};
struct
st_des_keyschedule
{
des
_key_schedule
ks1
,
ks2
,
ks3
;
DES
_key_schedule
ks1
,
ks2
,
ks3
;
};
extern
char
*
des_key_file
;
extern
struct
st_des_keyschedule
des_keyschedule
[
10
];
...
...
sql/sql_select.cc
View file @
5f164e2f
...
...
@@ -1898,7 +1898,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
best
=
best_time
=
records
=
DBL_MAX
;
KEYUSE
*
best_key
=
0
;
uint
best_max_key_part
=
0
;
my_bool
found_constrain
=
0
;
my_bool
found_constrain
t
=
0
;
if
(
s
->
keyuse
)
{
/* Use key if possible */
...
...
@@ -1979,7 +1979,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
}
else
{
found_constrain
=
1
;
found_constrain
t
=
1
;
/*
Check if we found full key
*/
...
...
@@ -2133,12 +2133,28 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
s
->
table
->
used_keys
&&
best_key
)
&&
!
(
s
->
table
->
force_index
&&
best_key
))
{
// Check full join
ha_rows
rnd_records
=
s
->
found_records
;
/* Estimate cost of reading table. */
tmp
=
(
double
)
s
->
read_time
;
tmp
=
s
->
table
->
file
->
scan_time
();
/*
If there is a restriction on the table, assume that 25% of the
rows can be skipped on next part.
This is to force tables that this table depends on before this
table
*/
if
(
found_constraint
)
rnd_records
-=
rnd_records
/
4
;
if
(
s
->
on_expr
)
// Can't use join cache
{
tmp
=
record_count
*
/* We have to read the whole table for each record */
tmp
*=
record_count
;
(
tmp
+
/*
And we have to skip rows which does not satisfy join
condition for each record.
*/
(
s
->
records
-
rnd_records
)
/
(
double
)
TIME_FOR_COMPARE
);
}
else
{
...
...
@@ -2146,30 +2162,25 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
tmp
*=
(
1.0
+
floor
((
double
)
cache_record_length
(
join
,
idx
)
*
record_count
/
(
double
)
thd
->
variables
.
join_buff_size
));
/*
We don't make full cartesian product between rows in the scanned
table and existing records because we skip all rows from the
scanned table, which does not satisfy join condition when
we read the table (see flush_cached_records for details). Here we
take into account cost to read and skip these records.
*/
tmp
+=
(
s
->
records
-
rnd_records
)
/
(
double
)
TIME_FOR_COMPARE
;
}
/*
We estimate the cost of making full cortesian product between
rows in the scanned table and generated records as
record_count*s->records/TIME_FOR_COMPARE. Taking into account
cost of evaluating WHERE clause for s->found_records is not
necessary because it costs much less than the cost mentioned
above.
We estimate the cost of evaluating WHERE clause for found records
as record_count * rnd_records + TIME_FOR_COMPARE. This cost plus
tmp give us total cost of using TABLE SCAN
*/
if
(
best
==
DBL_MAX
||
(
tmp
+
record_count
/
(
double
)
TIME_FOR_COMPARE
*
s
->
records
<
(
tmp
+
record_count
/
(
double
)
TIME_FOR_COMPARE
*
rnd_
records
<
best
+
record_count
/
(
double
)
TIME_FOR_COMPARE
*
records
))
{
/*
If there is a restriction on the table, assume that 25% of the
rows can be skipped on next part.
This is to force tables that this table depends on before this
table
*/
ha_rows
rnd_records
=
s
->
found_records
;
if
(
found_constrain
)
rnd_records
-=
rnd_records
/
4
;
/*
If the table has a range (s->quick is set) make_join_select()
will ensure that this will be used
...
...
support-files/mysql.server.sh
View file @
5f164e2f
...
...
@@ -178,7 +178,7 @@ case "$mode" in
# delete lock for RedHat / SuSE
if
test
-f
/var/lock/subsys/mysql
then
rm
/var/lock/subsys/mysql
rm
-f
/var/lock/subsys/mysql
fi
else
echo
"No mysqld pid file found. Looked for
$pid_file
."
...
...
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