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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4bde719d
Commit
4bde719d
authored
May 13, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Safety fix to enable RAID in max binaries
Better fix for format('nan') Fix for HAVING COUNT(DISTINCT...)
parent
5b7a86fa
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
110 additions
and
66 deletions
+110
-66
myisam/mi_check.c
myisam/mi_check.c
+8
-4
myisam/mi_dynrec.c
myisam/mi_dynrec.c
+8
-13
myisam/myisamchk.c
myisam/myisamchk.c
+9
-7
mysql-test/r/func_misc.result
mysql-test/r/func_misc.result
+3
-0
mysql-test/r/having.result
mysql-test/r/having.result
+8
-0
mysql-test/t/func_misc.test
mysql-test/t/func_misc.test
+5
-0
mysql-test/t/having.test
mysql-test/t/having.test
+2
-0
mysys/raid.cc
mysys/raid.cc
+2
-2
scripts/mysql_install_db.sh
scripts/mysql_install_db.sh
+2
-4
sql/item_strfunc.cc
sql/item_strfunc.cc
+8
-6
sql/mysqld.cc
sql/mysqld.cc
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-2
tests/big_record.pl
tests/big_record.pl
+34
-7
tests/table_types.pl
tests/table_types.pl
+14
-21
No files found.
myisam/mi_check.c
View file @
4bde719d
...
@@ -873,15 +873,19 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
...
@@ -873,15 +873,19 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
{
{
if
(
b_type
&
BLOCK_LAST
)
if
(
b_type
&
BLOCK_LAST
)
{
{
mi_check_print_error
(
param
,
"Record link to short for record at %s"
,
mi_check_print_error
(
param
,
llstr
(
start_recpos
,
llbuff
));
"Wrong record length %s of %s at %s"
,
llstr
(
block_info
.
rec_len
-
left_length
,
llbuff
),
llstr
(
block_info
.
rec_len
,
llbuff2
),
llstr
(
start_recpos
,
llbuff3
));
got_error
=
1
;
got_error
=
1
;
break
;
break
;
}
}
if
(
info
->
state
->
data_file_length
<
block_info
.
next_filepos
)
if
(
info
->
state
->
data_file_length
<
block_info
.
next_filepos
)
{
{
mi_check_print_error
(
param
,
"Found next-recordlink that points outside datafile at %s"
,
mi_check_print_error
(
param
,
llstr
(
block_info
.
filepos
,
llbuff
));
"Found next-recordlink that points outside datafile at %s"
,
llstr
(
block_info
.
filepos
,
llbuff
));
got_error
=
1
;
got_error
=
1
;
break
;
break
;
}
}
...
...
myisam/mi_dynrec.c
View file @
4bde719d
...
@@ -485,7 +485,7 @@ int _mi_write_part_record(MI_INFO *info,
...
@@ -485,7 +485,7 @@ int _mi_write_part_record(MI_INFO *info,
{
{
info
->
update
&=
~
HA_STATE_EXTEND_BLOCK
;
info
->
update
&=
~
HA_STATE_EXTEND_BLOCK
;
if
(
my_block_write
(
&
info
->
rec_cache
,(
byte
*
)
*
record
-
head_length
,
if
(
my_block_write
(
&
info
->
rec_cache
,(
byte
*
)
*
record
-
head_length
,
length
+
extra_length
+
del_length
,
filepos
))
length
+
extra_length
+
del_length
,
filepos
))
goto
err
;
goto
err
;
}
}
else
if
(
my_b_write
(
&
info
->
rec_cache
,(
byte
*
)
*
record
-
head_length
,
else
if
(
my_b_write
(
&
info
->
rec_cache
,(
byte
*
)
*
record
-
head_length
,
...
@@ -1412,10 +1412,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
...
@@ -1412,10 +1412,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
VOID
(
my_seek
(
file
,
filepos
,
MY_SEEK_SET
,
MYF
(
0
)));
VOID
(
my_seek
(
file
,
filepos
,
MY_SEEK_SET
,
MYF
(
0
)));
if
(
my_read
(
file
,(
char
*
)
header
,
sizeof
(
info
->
header
),
MYF
(
0
))
!=
if
(
my_read
(
file
,(
char
*
)
header
,
sizeof
(
info
->
header
),
MYF
(
0
))
!=
sizeof
(
info
->
header
))
sizeof
(
info
->
header
))
{
goto
err
;
my_errno
=
HA_ERR_WRONG_IN_RECORD
;
return
BLOCK_FATAL_ERROR
;
}
}
}
DBUG_DUMP
(
"header"
,(
byte
*
)
header
,
MI_BLOCK_INFO_HEADER_LENGTH
);
DBUG_DUMP
(
"header"
,(
byte
*
)
header
,
MI_BLOCK_INFO_HEADER_LENGTH
);
if
(
info
->
second_read
)
if
(
info
->
second_read
)
...
@@ -1435,10 +1432,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
...
@@ -1435,10 +1432,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
if
((
info
->
block_len
=
(
uint
)
mi_uint3korr
(
header
+
1
))
<
if
((
info
->
block_len
=
(
uint
)
mi_uint3korr
(
header
+
1
))
<
MI_MIN_BLOCK_LENGTH
||
MI_MIN_BLOCK_LENGTH
||
(
info
->
block_len
&
(
MI_DYN_ALIGN_SIZE
-
1
)))
(
info
->
block_len
&
(
MI_DYN_ALIGN_SIZE
-
1
)))
{
goto
err
;
my_errno
=
HA_ERR_WRONG_IN_RECORD
;
return
BLOCK_ERROR
;
}
info
->
filepos
=
filepos
;
info
->
filepos
=
filepos
;
info
->
next_filepos
=
mi_sizekorr
(
header
+
4
);
info
->
next_filepos
=
mi_sizekorr
(
header
+
4
);
info
->
prev_filepos
=
mi_sizekorr
(
header
+
12
);
info
->
prev_filepos
=
mi_sizekorr
(
header
+
12
);
...
@@ -1449,7 +1443,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
...
@@ -1449,7 +1443,7 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
(
mi_uint4korr
(
header
+
12
)
!=
0
&&
(
mi_uint4korr
(
header
+
12
)
!=
0
&&
(
mi_uint4korr
(
header
+
12
)
!=
(
ulong
)
~
0
||
(
mi_uint4korr
(
header
+
12
)
!=
(
ulong
)
~
0
||
info
->
prev_filepos
!=
(
ulong
)
~
0
)))
info
->
prev_filepos
!=
(
ulong
)
~
0
)))
return
BLOCK_FATAL_ERROR
;
goto
err
;
#endif
#endif
return
return_val
|
BLOCK_DELETED
;
/* Deleted block */
return
return_val
|
BLOCK_DELETED
;
/* Deleted block */
...
@@ -1529,8 +1523,9 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
...
@@ -1529,8 +1523,9 @@ uint _mi_get_block_info(MI_BLOCK_INFO *info, File file, my_off_t filepos)
info
->
second_read
=
1
;
info
->
second_read
=
1
;
info
->
filepos
=
filepos
+
12
;
info
->
filepos
=
filepos
+
12
;
return
return_val
;
return
return_val
;
default:
my_errno
=
HA_ERR_WRONG_IN_RECORD
;
/* Garbage */
return
BLOCK_ERROR
;
}
}
err:
my_errno
=
HA_ERR_WRONG_IN_RECORD
;
/* Garbage */
return
BLOCK_ERROR
;
}
}
myisam/myisamchk.c
View file @
4bde719d
...
@@ -44,6 +44,7 @@ static const char *load_default_groups[]= { "myisamchk", 0 };
...
@@ -44,6 +44,7 @@ static const char *load_default_groups[]= { "myisamchk", 0 };
static
const
char
*
set_charset_name
;
static
const
char
*
set_charset_name
;
static
CHARSET_INFO
*
set_charset
;
static
CHARSET_INFO
*
set_charset
;
static
long
opt_myisam_block_size
;
static
long
opt_myisam_block_size
;
static
const
char
*
my_progname_short
;
static
const
char
*
type_names
[]
=
static
const
char
*
type_names
[]
=
{
"?"
,
"char"
,
"binary"
,
"short"
,
"long"
,
"float"
,
{
"?"
,
"char"
,
"binary"
,
"short"
,
"long"
,
"float"
,
...
@@ -85,6 +86,7 @@ int main(int argc, char **argv)
...
@@ -85,6 +86,7 @@ int main(int argc, char **argv)
{
{
int
error
;
int
error
;
MY_INIT
(
argv
[
0
]);
MY_INIT
(
argv
[
0
]);
my_progname_short
=
my_progname
+
dirname_length
(
my_progname
);
#ifdef __EMX__
#ifdef __EMX__
_wildcard
(
&
argc
,
&
argv
);
_wildcard
(
&
argc
,
&
argv
);
...
@@ -330,7 +332,7 @@ static void usage(void)
...
@@ -330,7 +332,7 @@ static void usage(void)
puts
(
"This software comes with NO WARRANTY: see the PUBLIC for details.
\n
"
);
puts
(
"This software comes with NO WARRANTY: see the PUBLIC for details.
\n
"
);
puts
(
"Description, check and repair of MyISAM tables."
);
puts
(
"Description, check and repair of MyISAM tables."
);
puts
(
"Used without options all tables on the command will be checked for errors"
);
puts
(
"Used without options all tables on the command will be checked for errors"
);
printf
(
"Usage: %s [OPTIONS] tables[.MYI]
\n
"
,
my_progname
);
printf
(
"Usage: %s [OPTIONS] tables[.MYI]
\n
"
,
my_progname
_short
);
puts
(
"
\n
Global options:
\n
\
puts
(
"
\n
Global options:
\n
\
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'
\n
\
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'
\n
\
-?, --help Display this help and exit.
\n
\
-?, --help Display this help and exit.
\n
\
...
@@ -679,7 +681,7 @@ static void get_options(register int *argc,register char ***argv)
...
@@ -679,7 +681,7 @@ static void get_options(register int *argc,register char ***argv)
{
{
VOID
(
fprintf
(
stderr
,
VOID
(
fprintf
(
stderr
,
"%s: --unpack can't be used with --quick or --sort-records
\n
"
,
"%s: --unpack can't be used with --quick or --sort-records
\n
"
,
my_progname
));
my_progname
_short
));
exit
(
1
);
exit
(
1
);
}
}
if
((
check_param
.
testflag
&
T_READONLY
)
&&
if
((
check_param
.
testflag
&
T_READONLY
)
&&
...
@@ -689,7 +691,7 @@ static void get_options(register int *argc,register char ***argv)
...
@@ -689,7 +691,7 @@ static void get_options(register int *argc,register char ***argv)
{
{
VOID
(
fprintf
(
stderr
,
VOID
(
fprintf
(
stderr
,
"%s: Can't use --readonly when repairing or sorting
\n
"
,
"%s: Can't use --readonly when repairing or sorting
\n
"
,
my_progname
));
my_progname
_short
));
exit
(
1
);
exit
(
1
);
}
}
...
@@ -1655,13 +1657,13 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
...
@@ -1655,13 +1657,13 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
if
(
!
param
->
warning_printed
&&
!
param
->
error_printed
)
if
(
!
param
->
warning_printed
&&
!
param
->
error_printed
)
{
{
if
(
param
->
testflag
&
T_SILENT
)
if
(
param
->
testflag
&
T_SILENT
)
fprintf
(
stderr
,
"%s: MyISAM file %s
\n
"
,
my_progname
,
fprintf
(
stderr
,
"%s: MyISAM file %s
\n
"
,
my_progname
_short
,
param
->
isam_file_name
);
param
->
isam_file_name
);
param
->
out_flag
|=
O_DATA_LOST
;
param
->
out_flag
|=
O_DATA_LOST
;
}
}
param
->
warning_printed
=
1
;
param
->
warning_printed
=
1
;
va_start
(
args
,
fmt
);
va_start
(
args
,
fmt
);
fprintf
(
stderr
,
"%s: warning: "
,
my_progname
);
fprintf
(
stderr
,
"%s: warning: "
,
my_progname
_short
);
VOID
(
vfprintf
(
stderr
,
fmt
,
args
));
VOID
(
vfprintf
(
stderr
,
fmt
,
args
));
VOID
(
fputc
(
'\n'
,
stderr
));
VOID
(
fputc
(
'\n'
,
stderr
));
fflush
(
stderr
);
fflush
(
stderr
);
...
@@ -1681,12 +1683,12 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
...
@@ -1681,12 +1683,12 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
if
(
!
param
->
warning_printed
&&
!
param
->
error_printed
)
if
(
!
param
->
warning_printed
&&
!
param
->
error_printed
)
{
{
if
(
param
->
testflag
&
T_SILENT
)
if
(
param
->
testflag
&
T_SILENT
)
fprintf
(
stderr
,
"%s: MyISAM file %s
\n
"
,
my_progname
,
param
->
isam_file_name
);
fprintf
(
stderr
,
"%s: MyISAM file %s
\n
"
,
my_progname
_short
,
param
->
isam_file_name
);
param
->
out_flag
|=
O_DATA_LOST
;
param
->
out_flag
|=
O_DATA_LOST
;
}
}
param
->
error_printed
|=
1
;
param
->
error_printed
|=
1
;
va_start
(
args
,
fmt
);
va_start
(
args
,
fmt
);
fprintf
(
stderr
,
"%s: error: "
,
my_progname
);
fprintf
(
stderr
,
"%s: error: "
,
my_progname
_short
);
VOID
(
vfprintf
(
stderr
,
fmt
,
args
));
VOID
(
vfprintf
(
stderr
,
fmt
,
args
));
VOID
(
fputc
(
'\n'
,
stderr
));
VOID
(
fputc
(
'\n'
,
stderr
));
fflush
(
stderr
);
fflush
(
stderr
);
...
...
mysql-test/r/func_misc.result
View file @
4bde719d
...
@@ -10,3 +10,6 @@ inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
...
@@ -10,3 +10,6 @@ inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
NULL 255.255.1.255 0.0.1.255
NULL 255.255.1.255 0.0.1.255
select length(format('nan', 2)) > 0;
length(format('nan', 2)) > 0
1
mysql-test/r/having.result
View file @
4bde719d
...
@@ -69,4 +69,12 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2;
...
@@ -69,4 +69,12 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2;
id sqty
id sqty
1 5
1 5
2 9
2 9
select sum(qty) as sqty from t1 group by id having count(id) > 0;
sqty
5
9
select sum(qty) as sqty from t1 group by id having count(distinct id) > 0;
sqty
5
9
drop table t1;
drop table t1;
mysql-test/t/func_misc.test
View file @
4bde719d
...
@@ -7,3 +7,8 @@ select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.5555
...
@@ -7,3 +7,8 @@ select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.5555
select
inet_ntoa
(
inet_aton
(
"255.255.255.255.255.255.255.255"
));
select
inet_ntoa
(
inet_aton
(
"255.255.255.255.255.255.255.255"
));
select
inet_aton
(
"255.255.255.255.255"
),
inet_aton
(
"255.255.1.255"
),
inet_aton
(
"0.1.255"
);
select
inet_aton
(
"255.255.255.255.255"
),
inet_aton
(
"255.255.1.255"
),
inet_aton
(
"0.1.255"
);
select
inet_ntoa
(
1099511627775
),
inet_ntoa
(
4294902271
),
inet_ntoa
(
511
);
select
inet_ntoa
(
1099511627775
),
inet_ntoa
(
4294902271
),
inet_ntoa
(
511
);
#
# Test for core dump with nan
#
select
length
(
format
(
'nan'
,
2
))
>
0
;
mysql-test/t/having.test
View file @
4bde719d
...
@@ -63,4 +63,6 @@ drop table t1;
...
@@ -63,4 +63,6 @@ drop table t1;
create
table
t1
(
id
int
not
null
,
qty
int
not
null
);
create
table
t1
(
id
int
not
null
,
qty
int
not
null
);
insert
into
t1
values
(
1
,
2
),(
1
,
3
),(
2
,
4
),(
2
,
5
);
insert
into
t1
values
(
1
,
2
),(
1
,
3
),(
2
,
4
),(
2
,
5
);
select
id
,
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
sqty
>
2
;
select
id
,
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
sqty
>
2
;
select
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
count
(
id
)
>
0
;
select
sum
(
qty
)
as
sqty
from
t1
group
by
id
having
count
(
distinct
id
)
>
0
;
drop
table
t1
;
drop
table
t1
;
mysys/raid.cc
View file @
4bde719d
...
@@ -157,10 +157,10 @@ extern "C" {
...
@@ -157,10 +157,10 @@ extern "C" {
DBUG_PRINT
(
"enter"
,(
"Fd: %d pos: %lu whence: %d MyFlags: %d"
,
DBUG_PRINT
(
"enter"
,(
"Fd: %d pos: %lu whence: %d MyFlags: %d"
,
fd
,
(
ulong
)
pos
,
whence
,
MyFlags
));
fd
,
(
ulong
)
pos
,
whence
,
MyFlags
));
assert
(
pos
!=
MY_FILEPOS_ERROR
);
if
(
is_raid
(
fd
))
if
(
is_raid
(
fd
))
{
{
assert
(
pos
!=
MY_FILEPOS_ERROR
);
RaidFd
*
raid
=
(
*
dynamic_element
(
&
RaidFd
::
_raid_map
,
fd
,
RaidFd
**
));
RaidFd
*
raid
=
(
*
dynamic_element
(
&
RaidFd
::
_raid_map
,
fd
,
RaidFd
**
));
DBUG_RETURN
(
raid
->
Seek
(
pos
,
whence
,
MyFlags
));
DBUG_RETURN
(
raid
->
Seek
(
pos
,
whence
,
MyFlags
));
}
}
...
...
scripts/mysql_install_db.sh
View file @
4bde719d
...
@@ -118,7 +118,8 @@ then
...
@@ -118,7 +118,8 @@ then
resolved
=
`
$bindir
/resolveip localhost 2>&1
`
resolved
=
`
$bindir
/resolveip localhost 2>&1
`
if
[
$?
-eq
0
]
if
[
$?
-eq
0
]
then
then
echo
"Sorry, the host '
$hostname
' could not be looked up."
echo
"Neither host '
$hostname
' and 'localhost' could not be looked up with"
echo
"
$bindir
/resolveip"
echo
"Please configure the 'hostname' command to return a correct hostname."
echo
"Please configure the 'hostname' command to return a correct hostname."
echo
"If you want to solve this at a later stage, restart this script with"
echo
"If you want to solve this at a later stage, restart this script with"
echo
"the --force option"
echo
"the --force option"
...
@@ -134,15 +135,12 @@ then
...
@@ -134,15 +135,12 @@ then
fi
fi
# Create database directories mysql & test
# Create database directories mysql & test
if
test
"
$IN_RPM
"
-eq
0
then
if
test
!
-d
$ldata
;
then
mkdir
$ldata
;
chmod
700
$ldata
;
fi
if
test
!
-d
$ldata
;
then
mkdir
$ldata
;
chmod
700
$ldata
;
fi
if
test
!
-d
$ldata
/mysql
;
then
mkdir
$ldata
/mysql
;
chmod
700
$ldata
/mysql
;
fi
if
test
!
-d
$ldata
/mysql
;
then
mkdir
$ldata
/mysql
;
chmod
700
$ldata
/mysql
;
fi
if
test
!
-d
$ldata
/test
;
then
mkdir
$ldata
/test
;
chmod
700
$ldata
/test
;
fi
if
test
!
-d
$ldata
/test
;
then
mkdir
$ldata
/test
;
chmod
700
$ldata
/test
;
fi
if
test
-w
/
-a
!
-z
"
$user
"
;
then
if
test
-w
/
-a
!
-z
"
$user
"
;
then
chown
$user
$ldata
$ldata
/mysql
$ldata
/test
;
chown
$user
$ldata
$ldata
/mysql
$ldata
/test
;
fi
fi
fi
# Initialize variables
# Initialize variables
c_d
=
""
i_d
=
""
c_d
=
""
i_d
=
""
...
...
sql/item_strfunc.cc
View file @
4bde719d
...
@@ -1473,15 +1473,17 @@ String *Item_func_format::val_str(String *str)
...
@@ -1473,15 +1473,17 @@ String *Item_func_format::val_str(String *str)
str_length
=
str
->
length
();
str_length
=
str
->
length
();
if
(
nr
<
0
)
if
(
nr
<
0
)
str_length
--
;
// Don't count sign
str_length
--
;
// Don't count sign
length
=
str
->
length
()
+
(
diff
=
(
str_length
-
dec
-
1
)
/
3
);
if
(
diff
&&
diff
<
330
)
// size of buff ...
/* We need this test to handle 'nan' values */
if
(
str_length
>=
dec
+
4
)
{
{
char
*
tmp
,
*
pos
;
char
*
tmp
,
*
pos
;
str
=
copy_if_not_alloced
(
&
tmp_str
,
str
,
length
);
length
=
str
->
length
()
+
(
diff
=
(
str_length
-
dec
-
1
)
/
3
);
str
=
copy_if_not_alloced
(
&
tmp_str
,
str
,
length
);
str
->
length
(
length
);
str
->
length
(
length
);
tmp
=
(
char
*
)
str
->
ptr
()
+
length
-
dec
-
1
;
tmp
=
(
char
*
)
str
->
ptr
()
+
length
-
dec
-
1
;
for
(
pos
=
(
char
*
)
str
->
ptr
()
+
length
;
pos
!=
tmp
;
pos
--
)
for
(
pos
=
(
char
*
)
str
->
ptr
()
+
length
;
pos
!=
tmp
;
pos
--
)
pos
[
0
]
=
pos
[
-
(
int
)
diff
];
pos
[
0
]
=
pos
[
-
(
int
)
diff
];
while
(
diff
)
while
(
diff
)
{
{
pos
[
0
]
=
pos
[
-
(
int
)
diff
];
pos
--
;
pos
[
0
]
=
pos
[
-
(
int
)
diff
];
pos
--
;
...
...
sql/mysqld.cc
View file @
4bde719d
...
@@ -1607,6 +1607,7 @@ static void init_signals(void)
...
@@ -1607,6 +1607,7 @@ static void init_signals(void)
sa
.
sa_handler
=
handle_segfault
;
sa
.
sa_handler
=
handle_segfault
;
#endif
#endif
sigaction
(
SIGSEGV
,
&
sa
,
NULL
);
sigaction
(
SIGSEGV
,
&
sa
,
NULL
);
sigaction
(
SIGABRT
,
&
sa
,
NULL
);
#ifdef SIGBUS
#ifdef SIGBUS
sigaction
(
SIGBUS
,
&
sa
,
NULL
);
sigaction
(
SIGBUS
,
&
sa
,
NULL
);
#endif
#endif
...
...
sql/sql_yacc.yy
View file @
4bde719d
...
@@ -2017,8 +2017,12 @@ sum_expr:
...
@@ -2017,8 +2017,12 @@ sum_expr:
{ $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
{ $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
| COUNT_SYM '(' in_sum_expr ')'
| COUNT_SYM '(' in_sum_expr ')'
{ $$=new Item_sum_count($3); }
{ $$=new Item_sum_count($3); }
| COUNT_SYM '(' DISTINCT expr_list ')'
| COUNT_SYM '(' DISTINCT
{ $$=new Item_sum_count_distinct(* $4); }
{ Select->in_sum_expr++; }
expr_list
{ Select->in_sum_expr--; }
')'
{ $$=new Item_sum_count_distinct(* $5); }
| GROUP_UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' in_sum_expr ')'
| GROUP_UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' in_sum_expr ')'
{ $$= new Item_sum_unique_users($3,atoi($5.str),atoi($7.str),$9); }
{ $$= new Item_sum_unique_users($3,atoi($5.str),atoi($7.str),$9); }
| MIN_SYM '(' in_sum_expr ')'
| MIN_SYM '(' in_sum_expr ')'
...
...
tests/big_record.pl
View file @
4bde719d
...
@@ -11,12 +11,13 @@ use Getopt::Long;
...
@@ -11,12 +11,13 @@ use Getopt::Long;
$opt_host
=
"";
$opt_host
=
"";
$opt_user
=
$opt_password
=
"";
$opt_user
=
$opt_password
=
"";
$opt_db
=
"
test
";
$opt_db
=
"
test
";
$opt_rows
=
20
0
;
# Test of blobs up to ($rows-1)*100000+1 bytes
$opt_rows
=
20
;
# Test of blobs up to ($rows-1)*100000+1 bytes
$opt_compress
=
0
;
$opt_compress
=
0
;
$opt_table
=
"
test_big_record
";
$opt_table
=
"
test_big_record
";
$opt_loop_count
=
100000
;
# Change this to make test harder/easier
GetOptions
("
host=s
","
db=s
","
user=s
",
"
password=s
",
"
table=s
",
"
rows=i
",
GetOptions
("
host=s
","
db=s
","
user=s
",
"
password=s
",
"
table=s
",
"
rows=i
",
"
compress
")
||
die
"
Aborted
";
"
compress
"
,
"
loop-count=i
"
)
||
die
"
Aborted
";
print
"
Connection to database
$test_db
\n
";
print
"
Connection to database
$test_db
\n
";
...
@@ -42,12 +43,12 @@ $|=1; # Flush output to stdout to be able to monitor process
...
@@ -42,12 +43,12 @@ $|=1; # Flush output to stdout to be able to monitor process
for
(
$i
=
0
;
$i
<
$opt_rows
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_rows
;
$i
++
)
{
{
$tmp
=
chr
(
65
+
(
$i
%
16
))
x
(
$i
*
100000
+
1
);
$tmp
=
chr
(
65
+
(
$i
%
16
))
x
(
$i
*
100000
+
1
);
print
$i
,"
",
length
(
$tmp
),"
\n
";
$tmp
=
$dbh
->
quote
(
$tmp
);
$tmp
=
$dbh
->
quote
(
$tmp
);
$dbh
->
do
("
insert into
$opt_table
(test) values (
$tmp
)
")
or
die
$
DBI::
errstr
;
$dbh
->
do
("
insert into
$opt_table
(test) values (
$tmp
)
")
or
die
$
DBI::
errstr
;
print
"
.
";
}
}
print
"
Reading records
\n
";
print
"
\n
Reading records
\n
";
$sth
=
$dbh
->
prepare
("
select * from
$opt_table
",
{
"
mysql_use_result
"
=>
1
})
or
die
$dbh
->
errstr
;
$sth
=
$dbh
->
prepare
("
select * from
$opt_table
",
{
"
mysql_use_result
"
=>
1
})
or
die
$dbh
->
errstr
;
...
@@ -56,14 +57,40 @@ $sth->execute() or die $sth->errstr;
...
@@ -56,14 +57,40 @@ $sth->execute() or die $sth->errstr;
$i
=
0
;
$i
=
0
;
while
((
$row
=
$sth
->
fetchrow_arrayref
))
while
((
$row
=
$sth
->
fetchrow_arrayref
))
{
{
print
$row
->
[
0
],"
",
length
(
$row
->
[
1
]),"
\n
";
die
"
Record
$i
had wrong data in blob
"
if
(
$row
->
[
1
]
ne
(
chr
(
65
+
(
$i
%
16
))
x
(
$i
*
100000
+
1
)));
die
"
Record
$i
had wrong data in blob
"
if
(
$row
->
[
1
]
ne
(
chr
(
65
+
(
$i
%
16
))
x
(
$i
*
100000
+
1
)));
$i
++
;
$i
++
;
}
}
die
"
Didn't get all rows from server
"
if
(
$i
!=
$opt_rows
);
die
"
Didn't get all rows from server
"
if
(
$i
!=
$opt_rows
);
$dbh
->
do
("
drop table
$opt_table
")
or
die
$
DBI::
errstr
;
#
# Test by insert/updating/deleting random rows for a while
#
print
"
Test ok
\n
";
print
"
Testing insert/update/delete
\n
";
$max_row_id
=
$rows
;
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
{
$length
=
int
(
rand
65535
);
$tmp
=
chr
(
65
+
(
$i
%
16
))
x
$length
;
$tmp
=
$dbh
->
quote
(
$tmp
);
$dbh
->
do
("
insert into
$opt_table
(test) values (
$tmp
)
")
or
die
$
DBI::
errstr
;
$max_row_id
++
;
$length
=
int
(
rand
65535
);
$tmp
=
chr
(
65
+
(
$i
%
16
))
x
$length
;
$tmp
=
$dbh
->
quote
(
$tmp
);
$id
=
int
(
rand
$max_row_id
);
$dbh
->
do
("
update
$opt_table
set test=
$tmp
where auto=
$id
")
or
die
$
DBI::
errstr
;
if
((
$i
%
2
)
==
1
)
{
$id
=
int
(
rand
$max_row_id
);
$dbh
->
do
("
delete from
$opt_table
where auto=
$id
")
or
die
$
DBI::
errstr
;
}
print
"
.
"
if
(
$i
%
(
$opt_loop_count
/
100
)
==
1
);
}
# $dbh->do("drop table $opt_table") or die $DBI::errstr;
print
"
\n
Test ok
\n
";
exit
0
;
exit
0
;
tests/table_types.pl
View file @
4bde719d
...
@@ -66,13 +66,6 @@ $dbh = $server->connect();
...
@@ -66,13 +66,6 @@ $dbh = $server->connect();
####
####
$table_name
=
"
bench1
";
$table_name
=
"
bench1
";
<<<<<<<
table_types
.
pl
|||||||
1.2
test
("
n
","
type=isam
","
char
");
test
("
m
","
type=myisam pack_keys=1
","
char
");
exit
(
1
);
=======
>>>>>>>
/tmp/
T4a17019
test
(
$table_name
,"
type=isam
","
char
");
test
(
$table_name
,"
type=isam
","
char
");
test
(
$table_name
,"
type=myisam pack_keys=0
","
char
");
test
(
$table_name
,"
type=myisam pack_keys=0
","
char
");
test
(
$table_name
,"
type=myisam pack_keys=0
","
char
");
test
(
$table_name
,"
type=myisam pack_keys=0
","
char
");
...
@@ -91,7 +84,7 @@ exit (0);
...
@@ -91,7 +84,7 @@ exit (0);
sub
test
{
sub
test
{
my
(
$name
,
$options
,
$chartype
)
=
@_
;
my
(
$name
,
$options
,
$chartype
)
=
@_
;
print
"
\n
Testing with options: '
$options
'
\n
";
print
"
\n
Testing with options: '
$options
'
\n
";
$dbh
->
do
("
drop table
$name
");
$dbh
->
do
("
drop table
$name
");
do_many
(
$dbh
,
$server
->
create
("
$name
",
do_many
(
$dbh
,
$server
->
create
("
$name
",
...
@@ -102,23 +95,23 @@ sub test {
...
@@ -102,23 +95,23 @@ sub test {
["
primary key (id,id2)
",
["
primary key (id,id2)
",
"
index index_id3 (id3)
"],
"
index index_id3 (id3)
"],
$options
));
$options
));
if
(
$opt_lock_tables
)
if
(
$opt_lock_tables
)
{
{
$sth
=
$dbh
->
do
("
LOCK TABLES
$name
WRITE
")
||
die
$
DBI::
errstr
;
$sth
=
$dbh
->
do
("
LOCK TABLES
$name
WRITE
")
||
die
$
DBI::
errstr
;
}
}
if
(
$opt_fast
&&
defined
(
$server
->
{
vacuum
}))
if
(
$opt_fast
&&
defined
(
$server
->
{
vacuum
}))
{
{
$server
->
vacuum
(
\
$dbh
,
1
);
$server
->
vacuum
(
\
$dbh
,
1
);
}
}
####
####
#### Insert $total_rows records in order, in reverse order and random.
#### Insert $total_rows records in order, in reverse order and random.
####
####
$loop_time
=
new
Benchmark
;
$loop_time
=
new
Benchmark
;
if
(
$opt_fast_insert
)
if
(
$opt_fast_insert
)
{
{
$query
=
"
insert into
$name
values
";
$query
=
"
insert into
$name
values
";
...
@@ -127,11 +120,11 @@ sub test {
...
@@ -127,11 +120,11 @@ sub test {
{
{
$query
=
"
insert into
$name
(id,id2,id3,dummy1) values
";
$query
=
"
insert into
$name
(id,id2,id3,dummy1) values
";
}
}
if
((
$opt_fast
||
$opt_fast_insert
)
&&
$limits
->
{'
multi_value_insert
'})
if
((
$opt_fast
||
$opt_fast_insert
)
&&
$limits
->
{'
multi_value_insert
'})
{
{
$query_size
=
$server
->
{'
limits
'}
->
{'
query_size
'};
$query_size
=
$server
->
{'
limits
'}
->
{'
query_size
'};
print
"
Inserting
$opt_loop_count
multiple-value rows in order
\n
";
print
"
Inserting
$opt_loop_count
multiple-value rows in order
\n
";
$res
=
$query
;
$res
=
$query
;
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
...
@@ -186,7 +179,7 @@ sub test {
...
@@ -186,7 +179,7 @@ sub test {
{
{
$sth
=
$dbh
->
do
(
$query
.
"
(
$i
,
$i
,
$i
,'ABCDEFGHIJ')
")
or
die
$
DBI::
errstr
;
$sth
=
$dbh
->
do
(
$query
.
"
(
$i
,
$i
,
$i
,'ABCDEFGHIJ')
")
or
die
$
DBI::
errstr
;
}
}
print
"
Inserting
$opt_loop_count
rows in reverse order
\n
";
print
"
Inserting
$opt_loop_count
rows in reverse order
\n
";
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
{
{
...
@@ -195,25 +188,25 @@ sub test {
...
@@ -195,25 +188,25 @@ sub test {
(
$total_rows
-
1
-
$i
)
.
"
,'BCDEFGHIJK')
")
(
$total_rows
-
1
-
$i
)
.
"
,'BCDEFGHIJK')
")
or
die
$
DBI::
errstr
;
or
die
$
DBI::
errstr
;
}
}
print
"
Inserting
$opt_loop_count
rows in random order
\n
";
print
"
Inserting
$opt_loop_count
rows in random order
\n
";
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
for
(
$i
=
0
;
$i
<
$opt_loop_count
;
$i
++
)
{
{
$sth
=
$dbh
->
do
(
$query
.
"
(
"
.
$random
[
$i
]
.
"
,
"
.
$random
[
$i
]
.
$sth
=
$dbh
->
do
(
$query
.
"
(
"
.
$random
[
$i
]
.
"
,
"
.
$random
[
$i
]
.
"
,
"
.
$random
[
$i
]
.
"
,'CDEFGHIJKL')
")
or
die
$
DBI::
errstr
;
"
,
"
.
$random
[
$i
]
.
"
,'CDEFGHIJKL')
")
or
die
$
DBI::
errstr
;
}
}
}
}
$end_time
=
new
Benchmark
;
$end_time
=
new
Benchmark
;
print
"
Time for insert (
"
.
(
$total_rows
)
.
"
):
"
.
print
"
Time for insert (
"
.
(
$total_rows
)
.
"
):
"
.
timestr
(
timediff
(
$end_time
,
$loop_time
),"
all
")
.
"
\n\n
";
timestr
(
timediff
(
$end_time
,
$loop_time
),"
all
")
.
"
\n\n
";
if
(
$opt_fast
&&
defined
(
$server
->
{
vacuum
}))
if
(
$opt_fast
&&
defined
(
$server
->
{
vacuum
}))
{
{
$server
->
vacuum
(
\
$dbh
,
1
);
$server
->
vacuum
(
\
$dbh
,
1
);
}
}
$sth
=
$dbh
->
prepare
("
show table status like '
$name
'
");
$sth
=
$dbh
->
prepare
("
show table status like '
$name
'
");
$sth
->
execute
||
die
"
Show table status returned error:
$DBI
::errstr
\n
";
$sth
->
execute
||
die
"
Show table status returned error:
$DBI
::errstr
\n
";
while
(
@row
=
$sth
->
fetchrow_array
)
while
(
@row
=
$sth
->
fetchrow_array
)
...
...
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