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
461d1627
Commit
461d1627
authored
Oct 13, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
merge with 4.0 for more memory allocation variables.
parents
c60a75e9
c95d142f
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
362 additions
and
68 deletions
+362
-68
configure.in
configure.in
+1
-1
mysql-test/r/variables.result
mysql-test/r/variables.result
+32
-0
mysql-test/t/variables.test
mysql-test/t/variables.test
+12
-0
scripts/Makefile.am
scripts/Makefile.am
+3
-1
scripts/make_sharedlib_distribution.sh
scripts/make_sharedlib_distribution.sh
+117
-0
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+1
-1
sql/mysql_priv.h
sql/mysql_priv.h
+10
-0
sql/mysqld.cc
sql/mysqld.cc
+29
-0
sql/opt_ft.cc
sql/opt_ft.cc
+4
-4
sql/opt_ft.h
sql/opt_ft.h
+4
-3
sql/opt_range.cc
sql/opt_range.cc
+66
-37
sql/opt_range.h
sql/opt_range.h
+8
-6
sql/set_var.cc
sql/set_var.cc
+25
-0
sql/sql_acl.cc
sql/sql_acl.cc
+2
-2
sql/sql_class.h
sql/sql_class.h
+6
-1
sql/sql_delete.cc
sql/sql_delete.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+11
-8
sql/sql_test.cc
sql/sql_test.cc
+27
-0
sql/sql_udf.cc
sql/sql_udf.cc
+1
-1
sql/sql_update.cc
sql/sql_update.cc
+1
-1
sql/table.cc
sql/table.cc
+1
-1
No files found.
configure.in
View file @
461d1627
...
...
@@ -1821,7 +1821,7 @@ AC_CHECK_FUNCS(alarm bmove \
cuserid fcntl fconvert poll
\
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp
\
perror pread
realpath readlink
rename
\
socket strnlen madvise mkstemp
\
socket strnlen madvise m
allinfo m
kstemp
\
strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency
\
gethostbyaddr_r gethostbyname_r getpwnam
\
bfill bzero bcmp strstr strpbrk strerror
\
...
...
mysql-test/r/variables.result
View file @
461d1627
...
...
@@ -163,6 +163,38 @@ set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5);
ROUND(RAND(),5)
0.02887
show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18;
set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
@@query_alloc_block_size
17408
show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 17408
query_prealloc_size 18432
range_alloc_block_size 16384
transaction_alloc_block_size 19456
transaction_prealloc_size 20480
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%';
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
range_alloc_block_size 2048
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
set big_tables=OFFF;
ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
set big_tables="OFFF";
...
...
mysql-test/t/variables.test
View file @
461d1627
...
...
@@ -98,6 +98,18 @@ select @@timestamp>0;
set
@@
rand_seed1
=
10000000
,
@@
rand_seed2
=
1000000
;
select
ROUND
(
RAND
(),
5
);
show
variables
like
'%alloc%'
;
set
@@
range_alloc_block_size
=
1024
*
16
;
set
@@
query_alloc_block_size
=
1024
*
17
+
2
;
set
@@
query_prealloc_size
=
1024
*
18
;
set
@@
transaction_alloc_block_size
=
1024
*
20
-
1
;
set
@@
transaction_prealloc_size
=
1024
*
21
-
1
;
select
@@
query_alloc_block_size
;
show
variables
like
'%alloc%'
;
set
@@
range_alloc_block_size
=
default
;
set
@@
query_alloc_block_size
=
default
,
@@
query_prealloc_size
=
default
;
set
transaction_alloc_block_size
=
default
,
@@
transaction_prealloc_size
=
default
;
show
variables
like
'%alloc%'
;
# The following should give errors
...
...
scripts/Makefile.am
View file @
461d1627
...
...
@@ -37,6 +37,7 @@ bin_SCRIPTS = @server_scripts@ \
mysql_create_system_tables
EXTRA_SCRIPTS
=
make_binary_distribution.sh
\
make_sharedlib_distribution.sh
\
make_win_src_distribution.sh
\
msql2mysql.sh
\
mysql_config.sh
\
...
...
@@ -69,6 +70,7 @@ dist_pkgdata_DATA = fill_help_tables.sql mysql_fix_privilege_tables.sql
# failures with it.
CLEANFILES
=
@server_scripts@
\
make_binary_distribution
\
make_sharedlib_distribution
\
msql2mysql
\
mysql_config
\
mysql_fix_privilege_tables
\
...
...
@@ -141,7 +143,7 @@ SUFFIXES = .sh
# Don't update the files from bitkeeper
%
::
SCCS/s.%
all
:
fill_help_tables.sql make_win_src_distribution make_binary_distribution
all
:
fill_help_tables.sql make_win_src_distribution make_binary_distribution
make_sharedlib_distribution
fill_help_tables.sql
:
fill_help_tables ../Docs/manual.texi
./fill_help_tables < ../Docs/manual.texi
>
fill_help_tables.sql
scripts/make_sharedlib_distribution.sh
0 → 100644
View file @
461d1627
#!/bin/sh
# The default path should be /usr/local
# Get some info from configure
# chmod +x ./scripts/setsomevars
machine
=
@MACHINE_TYPE@
system
=
@SYSTEM_TYPE@
version
=
@VERSION@
export
machine system version
SOURCE
=
`
pwd
`
CP
=
"cp -p"
MV
=
"mv"
STRIP
=
1
DEBUG
=
0
SILENT
=
0
TMP
=
/tmp
SUFFIX
=
""
parse_arguments
()
{
for
arg
do
case
"
$arg
"
in
--debug
)
DEBUG
=
1
;;
--tmp
=
*
)
TMP
=
`
echo
"
$arg
"
|
sed
-e
"s;--tmp=;;"
`
;;
--suffix
=
*
)
SUFFIX
=
`
echo
"
$arg
"
|
sed
-e
"s;--suffix=;;"
`
;;
--no-strip
)
STRIP
=
0
;;
--silent
)
SILENT
=
1
;;
*
)
echo
"Unknown argument '
$arg
'"
exit
1
;;
esac
done
}
parse_arguments
"
$@
"
BASE
=
$TMP
/my_dist
$SUFFIX
if
[
-d
$BASE
]
;
then
rm
-r
-f
$BASE
fi
mkdir
-p
$BASE
/lib
for
i
in
\
libmysql/.libs/libmysqlclient.so
*
\
libmysql_r/.libs/libmysqlclient_r.so
*
do
if
[
-f
$i
]
then
$CP
$i
$BASE
/lib
fi
done
# Change the distribution to a long descriptive name
NEW_NAME
=
mysql-shared-
$version
-
$system
-
$machine$SUFFIX
BASE2
=
$TMP
/
$NEW_NAME
rm
-r
-f
$BASE2
mv
$BASE
$BASE2
BASE
=
$BASE2
#if we are debugging, do not do tar/gz
if
[
x
$DEBUG
=
x1
]
;
then
exit
fi
# This is needed to prefer GNU tar instead of tar because tar can't
# always handle long filenames
PATH_DIRS
=
`
echo
$PATH
|
sed
-e
's/^:/. /'
-e
's/:$/ ./'
-e
's/::/ . /g'
-e
's/:/ /g'
`
which_1
()
{
for
cmd
do
for
d
in
$PATH_DIRS
do
for
file
in
$d
/
$cmd
do
if
test
-x
$file
-a
!
-d
$file
then
echo
$file
exit
0
fi
done
done
done
exit
1
}
#
# Create the result tar file
#
tar
=
`
which_1 gnutar gtar
`
if
test
"
$?
"
=
"1"
-o
"
$tar
"
=
""
then
tar
=
tar
fi
echo
"Using
$tar
to create archive"
cd
$TMP
OPT
=
cvf
if
[
x
$SILENT
=
x1
]
;
then
OPT
=
cf
fi
$tar
$OPT
$SOURCE
/
$NEW_NAME
.tar
$NEW_NAME
cd
$SOURCE
echo
"Compressing archive"
gzip
-9
$NEW_NAME
.tar
echo
"Removing temporary directory"
rm
-r
-f
$BASE
echo
"
$NEW_NAME
.tar.gz created"
sql/ha_berkeley.cc
View file @
461d1627
...
...
@@ -238,7 +238,7 @@ int berkeley_show_logs(Protocol *protocol)
MEM_ROOT
*
old_root
=
my_pthread_getspecific_ptr
(
MEM_ROOT
*
,
THR_MALLOC
);
DBUG_ENTER
(
"berkeley_show_logs"
);
init_
alloc_root
(
&
show_logs_root
,
1024
,
1024
);
init_
sql_alloc
(
&
show_logs_root
,
1024
,
1024
);
my_pthread_setspecific_ptr
(
THR_MALLOC
,
&
show_logs_root
);
if
((
error
=
db_env
->
log_archive
(
db_env
,
&
all_logs
,
...
...
sql/mysql_priv.h
View file @
461d1627
...
...
@@ -85,6 +85,16 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int.
#endif
#define TEMP_POOL_SIZE 128
#define QUERY_ALLOC_BLOCK_SIZE 8192
#define QUERY_ALLOC_PREALLOC_SIZE 8192
#define TRANS_ALLOC_BLOCK_SIZE 4096
#define TRANS_ALLOC_PREALLOC_SIZE 4096
#define RANGE_ALLOC_BLOCK_SIZE 2048
#define ACL_ALLOC_BLOCK_SIZE 1024
#define UDF_ALLOC_BLOCK_SIZE 1024
#define TABLE_ALLOC_BLOCK_SIZE 1024
/*
The following parameters is to decide when to use an extra cache to
optimise seeks when reading a big table in sorted order
...
...
sql/mysqld.cc
View file @
461d1627
...
...
@@ -3567,6 +3567,10 @@ enum options
OPT_BDB_LOG_BUFFER_SIZE
,
OPT_BDB_MAX_LOCK
,
OPT_ERROR_LOG_FILE
,
OPT_DEFAULT_WEEK_FORMAT
,
OPT_RANGE_ALLOC_BLOCK_SIZE
,
OPT_QUERY_ALLOC_BLOCK_SIZE
,
OPT_QUERY_PREALLOC_SIZE
,
OPT_TRANS_ALLOC_BLOCK_SIZE
,
OPT_TRANS_PREALLOC_SIZE
,
OPT_ENABLE_SHARED_MEMORY
,
OPT_SHARED_MEMORY_BASE_NAME
,
OPT_OLD_PASSWORDS
,
...
...
@@ -4392,6 +4396,11 @@ The minimum value for this variable is 4096.",
(
gptr
*
)
&
global_system_variables
.
preload_buff_size
,
(
gptr
*
)
&
max_system_variables
.
preload_buff_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
32
*
1024L
,
1024
,
1024
*
1024
*
1024L
,
0
,
1
,
0
},
{
"query_alloc_block_size"
,
OPT_QUERY_ALLOC_BLOCK_SIZE
,
"Allocation block size for query parsing and execution"
,
(
gptr
*
)
&
global_system_variables
.
query_alloc_block_size
,
(
gptr
*
)
&
max_system_variables
.
query_alloc_block_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
QUERY_ALLOC_BLOCK_SIZE
,
1024
,
~
0L
,
0
,
1024
,
0
},
#ifdef HAVE_QUERY_CACHE
{
"query_cache_limit"
,
OPT_QUERY_CACHE_LIMIT
,
"Don't cache results that are bigger than this."
,
...
...
@@ -4413,6 +4422,11 @@ The minimum value for this variable is 4096.",
(
gptr
*
)
&
global_system_variables
.
query_cache_type
,
(
gptr
*
)
&
max_system_variables
.
query_cache_type
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1
,
0
,
2
,
0
,
1
,
0
},
{
"query_prealloc_size"
,
OPT_QUERY_PREALLOC_SIZE
,
"Persistent buffer for query parsing and execution"
,
(
gptr
*
)
&
global_system_variables
.
query_prealloc_size
,
(
gptr
*
)
&
max_system_variables
.
query_prealloc_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
QUERY_ALLOC_PREALLOC_SIZE
,
1024
,
~
0L
,
0
,
1024
,
0
},
#endif
/*HAVE_QUERY_CACHE*/
{
"read_buffer_size"
,
OPT_RECORD_BUFFER
,
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value."
,
...
...
@@ -4451,6 +4465,11 @@ The minimum value for this variable is 4096.",
(
gptr
*
)
&
slave_net_timeout
,
(
gptr
*
)
&
slave_net_timeout
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
SLAVE_NET_TIMEOUT
,
1
,
LONG_TIMEOUT
,
0
,
1
,
0
},
#endif
/* HAVE_REPLICATION */
{
"range_alloc_block_size"
,
OPT_RANGE_ALLOC_BLOCK_SIZE
,
"Allocation block size for storing ranges during optimization"
,
(
gptr
*
)
&
global_system_variables
.
range_alloc_block_size
,
(
gptr
*
)
&
max_system_variables
.
range_alloc_block_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
RANGE_ALLOC_BLOCK_SIZE
,
1024
,
~
0L
,
0
,
1024
,
0
},
{
"read-only"
,
OPT_READONLY
,
"Make all tables readonly, with the expections for replications (slave) threads and users with the SUPER privilege."
,
(
gptr
*
)
&
opt_readonly
,
...
...
@@ -4487,6 +4506,16 @@ The minimum value for this variable is 4096.",
"The stack size for each thread."
,
(
gptr
*
)
&
thread_stack
,
(
gptr
*
)
&
thread_stack
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
DEFAULT_THREAD_STACK
,
1024
*
32
,
~
0L
,
0
,
1024
,
0
},
{
"transaction_alloc_block_size"
,
OPT_TRANS_ALLOC_BLOCK_SIZE
,
"Allocation block size for transactions to be stored in binary log"
,
(
gptr
*
)
&
global_system_variables
.
trans_alloc_block_size
,
(
gptr
*
)
&
max_system_variables
.
trans_alloc_block_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
QUERY_ALLOC_BLOCK_SIZE
,
1024
,
~
0L
,
0
,
1024
,
0
},
{
"transaction_prealloc_size"
,
OPT_TRANS_PREALLOC_SIZE
,
"Persistent buffer for transactions to be stored in binary log"
,
(
gptr
*
)
&
global_system_variables
.
trans_prealloc_size
,
(
gptr
*
)
&
max_system_variables
.
trans_prealloc_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
TRANS_ALLOC_PREALLOC_SIZE
,
1024
,
~
0L
,
0
,
1024
,
0
},
{
"wait_timeout"
,
OPT_WAIT_TIMEOUT
,
"The number of seconds the server waits for activity on a connection before closing it."
,
(
gptr
*
)
&
global_system_variables
.
net_wait_timeout
,
...
...
sql/opt_ft.cc
View file @
461d1627
...
...
@@ -26,11 +26,11 @@
** Create a FT or QUICK RANGE based on a key
****************************************************************************/
QUICK_SELECT
*
get_ft_or_quick_select_for_ref
(
TABLE
*
table
,
JOIN_TAB
*
tab
)
QUICK_SELECT
*
get_ft_or_quick_select_for_ref
(
THD
*
thd
,
TABLE
*
table
,
JOIN_TAB
*
tab
)
{
if
(
tab
->
type
==
JT_FT
)
return
new
FT_SELECT
(
table
,
&
tab
->
ref
);
else
return
get_quick_select_for_ref
(
table
,
&
tab
->
ref
);
return
new
FT_SELECT
(
thd
,
table
,
&
tab
->
ref
);
return
get_quick_select_for_ref
(
thd
,
table
,
&
tab
->
ref
);
}
sql/opt_ft.h
View file @
461d1627
...
...
@@ -28,13 +28,14 @@ class FT_SELECT: public QUICK_SELECT {
public:
TABLE_REF
*
ref
;
FT_SELECT
(
TABLE
*
table
,
TABLE_REF
*
tref
)
:
QUICK_SELECT
(
t
able
,
tref
->
key
,
1
),
ref
(
tref
)
{
init
();
}
FT_SELECT
(
T
HD
*
thd
,
T
ABLE
*
table
,
TABLE_REF
*
tref
)
:
QUICK_SELECT
(
t
hd
,
table
,
tref
->
key
,
1
),
ref
(
tref
)
{
init
();
}
int
init
()
{
return
error
=
file
->
ft_init
();
}
int
get_next
()
{
return
error
=
file
->
ft_read
(
record
);
}
};
QUICK_SELECT
*
get_ft_or_quick_select_for_ref
(
TABLE
*
table
,
JOIN_TAB
*
tab
);
QUICK_SELECT
*
get_ft_or_quick_select_for_ref
(
THD
*
thd
,
TABLE
*
table
,
JOIN_TAB
*
tab
);
#endif
sql/opt_range.cc
View file @
461d1627
This diff is collapsed.
Click to expand it.
sql/opt_range.h
View file @
461d1627
...
...
@@ -83,7 +83,7 @@ public:
ha_rows
records
;
double
read_time
;
QUICK_SELECT
(
TABLE
*
table
,
uint
index_arg
,
bool
no_alloc
=
0
);
QUICK_SELECT
(
T
HD
*
thd
,
T
ABLE
*
table
,
uint
index_arg
,
bool
no_alloc
=
0
);
virtual
~
QUICK_SELECT
();
void
reset
(
void
)
{
next
=
0
;
it
.
rewind
();
}
int
init
()
{
return
error
=
file
->
index_init
(
index
);
}
...
...
@@ -127,13 +127,15 @@ class SQL_SELECT :public Sql_alloc {
SQL_SELECT
();
~
SQL_SELECT
();
bool
check_quick
(
bool
force_quick_range
=
0
,
ha_rows
limit
=
HA_POS_ERROR
)
{
return
test_quick_select
(
~
0L
,
0
,
limit
,
force_quick_range
)
<
0
;
}
bool
check_quick
(
THD
*
thd
,
bool
force_quick_range
=
0
,
ha_rows
limit
=
HA_POS_ERROR
)
{
return
test_quick_select
(
thd
,
~
0L
,
0
,
limit
,
force_quick_range
)
<
0
;
}
inline
bool
skipp_record
()
{
return
cond
?
cond
->
val_int
()
==
0
:
0
;
}
int
test_quick_select
(
key_map
keys
,
table_map
prev_tables
,
ha_rows
limit
,
bool
force_quick_range
=
0
);
int
test_quick_select
(
THD
*
thd
,
key_map
keys
,
table_map
prev_tables
,
ha_rows
limit
,
bool
force_quick_range
=
0
);
};
QUICK_SELECT
*
get_quick_select_for_ref
(
TABLE
*
table
,
struct
st_table_ref
*
ref
);
QUICK_SELECT
*
get_quick_select_for_ref
(
THD
*
thd
,
TABLE
*
table
,
struct
st_table_ref
*
ref
);
#endif
sql/set_var.cc
View file @
461d1627
...
...
@@ -235,6 +235,18 @@ sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank",
sys_var_long_ptr
sys_query_cache_size
(
"query_cache_size"
,
&
query_cache_size
,
fix_query_cache_size
);
sys_var_thd_ulong
sys_range_alloc_block_size
(
"range_alloc_block_size"
,
&
SV
::
range_alloc_block_size
);
sys_var_thd_ulong
sys_query_alloc_block_size
(
"query_alloc_block_size"
,
&
SV
::
query_alloc_block_size
);
sys_var_thd_ulong
sys_query_prealloc_size
(
"query_prealloc_size"
,
&
SV
::
query_prealloc_size
);
sys_var_thd_ulong
sys_trans_alloc_block_size
(
"transaction_alloc_block_size"
,
&
SV
::
trans_alloc_block_size
);
sys_var_thd_ulong
sys_trans_prealloc_size
(
"transaction_prealloc_size"
,
&
SV
::
trans_prealloc_size
);
#ifdef HAVE_QUERY_CACHE
sys_var_long_ptr
sys_query_cache_limit
(
"query_cache_limit"
,
&
query_cache
.
query_cache_limit
);
...
...
@@ -441,7 +453,9 @@ sys_var *sys_variables[]=
&
sys_old_passwords
,
&
sys_preload_buff_size
,
&
sys_pseudo_thread_id
,
&
sys_query_alloc_block_size
,
&
sys_query_cache_size
,
&
sys_query_prealloc_size
,
#ifdef HAVE_QUERY_CACHE
&
sys_query_cache_limit
,
&
sys_query_cache_min_res_unit
,
...
...
@@ -452,6 +466,7 @@ sys_var *sys_variables[]=
&
sys_rand_seed2
,
&
sys_read_buff_size
,
&
sys_read_rnd_buff_size
,
&
sys_range_alloc_block_size
,
#ifdef HAVE_REPLICATION
&
sys_relay_log_purge
,
#endif
...
...
@@ -478,6 +493,8 @@ sys_var *sys_variables[]=
&
sys_thread_cache_size
,
&
sys_timestamp
,
&
sys_tmp_table_size
,
&
sys_trans_alloc_block_size
,
&
sys_trans_prealloc_size
,
&
sys_tx_isolation
,
#ifdef HAVE_INNOBASE_DB
&
sys_innodb_max_dirty_pages_pct
,
...
...
@@ -629,6 +646,8 @@ struct show_var_st init_vars[]= {
{
"protocol_version"
,
(
char
*
)
&
protocol_version
,
SHOW_INT
},
{
sys_preload_buff_size
.
name
,
(
char
*
)
&
sys_preload_buff_size
,
SHOW_SYS
},
{
sys_pseudo_thread_id
.
name
,
(
char
*
)
&
sys_pseudo_thread_id
,
SHOW_SYS
},
{
sys_query_alloc_block_size
.
name
,
(
char
*
)
&
sys_query_alloc_block_size
,
SHOW_SYS
},
#ifdef HAVE_QUERY_CACHE
{
sys_query_cache_limit
.
name
,(
char
*
)
&
sys_query_cache_limit
,
SHOW_SYS
},
{
sys_query_cache_min_res_unit
.
name
,
(
char
*
)
&
sys_query_cache_min_res_unit
,
...
...
@@ -637,9 +656,12 @@ struct show_var_st init_vars[]= {
{
sys_query_cache_type
.
name
,
(
char
*
)
&
sys_query_cache_type
,
SHOW_SYS
},
{
"secure_auth"
,
(
char
*
)
&
sys_secure_auth
,
SHOW_SYS
},
#endif
/* HAVE_QUERY_CACHE */
{
sys_query_prealloc_size
.
name
,
(
char
*
)
&
sys_query_prealloc_size
,
SHOW_SYS
},
{
sys_read_buff_size
.
name
,
(
char
*
)
&
sys_read_buff_size
,
SHOW_SYS
},
{
sys_readonly
.
name
,
(
char
*
)
&
sys_readonly
,
SHOW_SYS
},
{
sys_read_rnd_buff_size
.
name
,(
char
*
)
&
sys_read_rnd_buff_size
,
SHOW_SYS
},
{
sys_range_alloc_block_size
.
name
,
(
char
*
)
&
sys_range_alloc_block_size
,
SHOW_SYS
},
#ifdef HAVE_REPLICATION
{
sys_relay_log_purge
.
name
,
(
char
*
)
&
sys_relay_log_purge
,
SHOW_SYS
},
#endif
...
...
@@ -675,6 +697,9 @@ struct show_var_st init_vars[]= {
#endif
{
sys_tmp_table_size
.
name
,
(
char
*
)
&
sys_tmp_table_size
,
SHOW_SYS
},
{
"tmpdir"
,
(
char
*
)
&
opt_mysql_tmpdir
,
SHOW_CHAR_PTR
},
{
sys_trans_alloc_block_size
.
name
,
(
char
*
)
&
sys_trans_alloc_block_size
,
SHOW_SYS
},
{
sys_trans_prealloc_size
.
name
,
(
char
*
)
&
sys_trans_prealloc_size
,
SHOW_SYS
},
{
"version"
,
server_version
,
SHOW_CHAR
},
{
sys_net_wait_timeout
.
name
,
(
char
*
)
&
sys_net_wait_timeout
,
SHOW_SYS
},
{
NullS
,
NullS
,
SHOW_LONG
}
...
...
sql/sql_acl.cc
View file @
461d1627
...
...
@@ -186,7 +186,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
thd
->
net
.
last_error
);
goto
end
;
}
init_sql_alloc
(
&
mem
,
1024
,
0
);
init_sql_alloc
(
&
mem
,
ACL_ALLOC_BLOCK_SIZE
,
0
);
init_read_record
(
&
read_record_info
,
thd
,
table
=
tables
[
0
].
table
,
NULL
,
1
,
0
);
VOID
(
my_init_dynamic_array
(
&
acl_hosts
,
sizeof
(
ACL_HOST
),
20
,
50
));
while
(
!
(
read_record_info
.
read_record
(
&
read_record_info
)))
...
...
@@ -2450,7 +2450,7 @@ my_bool grant_init(THD *org_thd)
(
void
)
hash_init
(
&
column_priv_hash
,
&
my_charset_latin1
,
0
,
0
,
0
,
(
hash_get_key
)
get_grant_table
,
(
hash_free_key
)
free_grant_table
,
0
);
init_sql_alloc
(
&
memex
,
1024
,
0
);
init_sql_alloc
(
&
memex
,
ACL_ALLOC_BLOCK_SIZE
,
0
);
/* Don't do anything if running with --skip-grant */
if
(
!
initialized
)
...
...
sql/sql_class.h
View file @
461d1627
...
...
@@ -392,10 +392,15 @@ struct system_variables
ulong
table_type
;
ulong
tmp_table_size
;
ulong
tx_isolation
;
/* Determines
if
which non-standard SQL behaviour should be enabled */
/* Determines which non-standard SQL behaviour should be enabled */
ulong
sql_mode
;
ulong
default_week_format
;
ulong
max_seeks_for_key
;
ulong
range_alloc_block_size
;
ulong
query_alloc_block_size
;
ulong
query_prealloc_size
;
ulong
trans_alloc_block_size
;
ulong
trans_prealloc_size
;
ulong
group_concat_max_len
;
/*
In slave thread we need to know in behalf of which
...
...
sql/sql_delete.cc
View file @
461d1627
...
...
@@ -89,7 +89,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
)
DBUG_RETURN
(
-
1
);
if
((
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
if
((
select
&&
select
->
check_quick
(
thd
,
safe_update
,
limit
))
||
!
limit
)
{
delete
select
;
free_underlaid_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
...
...
sql/sql_select.cc
View file @
461d1627
...
...
@@ -1574,7 +1574,8 @@ err:
Approximate how many records will be used in each table
*****************************************************************************/
static
ha_rows
get_quick_record_count
(
SQL_SELECT
*
select
,
TABLE
*
table
,
static
ha_rows
get_quick_record_count
(
THD
*
thd
,
SQL_SELECT
*
select
,
TABLE
*
table
,
key_map
keys
,
ha_rows
limit
)
{
int
error
;
...
...
@@ -1583,7 +1584,7 @@ static ha_rows get_quick_record_count(SQL_SELECT *select,TABLE *table,
{
select
->
head
=
table
;
table
->
reginfo
.
impossible_range
=
0
;
if
((
error
=
select
->
test_quick_select
(
keys
,(
table_map
)
0
,
limit
))
if
((
error
=
select
->
test_quick_select
(
thd
,
keys
,(
table_map
)
0
,
limit
))
==
1
)
DBUG_RETURN
(
select
->
quick
->
records
);
if
(
error
==
-
1
)
...
...
@@ -1866,8 +1867,8 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
found_const_table_map
,
s
->
on_expr
?
s
->
on_expr
:
conds
,
&
error
);
records
=
get_quick_record_count
(
select
,
s
->
table
,
s
->
const_keys
,
join
->
row_limit
);
records
=
get_quick_record_count
(
join
->
thd
,
select
,
s
->
table
,
s
->
const_keys
,
join
->
row_limit
);
s
->
quick
=
select
->
quick
;
s
->
needed_reg
=
select
->
needed_reg
;
select
->
quick
=
0
;
...
...
@@ -3377,7 +3378,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
/* Join with outer join condition */
COND
*
orig_cond
=
sel
->
cond
;
sel
->
cond
=
and_conds
(
sel
->
cond
,
tab
->
on_expr
);
if
(
sel
->
test_quick_select
(
tab
->
keys
,
if
(
sel
->
test_quick_select
(
join
->
thd
,
tab
->
keys
,
used_tables
&
~
current_map
,
(
join
->
select_options
&
OPTION_FOUND_ROWS
?
...
...
@@ -3390,7 +3391,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*/
sel
->
cond
=
orig_cond
;
if
(
!
tab
->
on_expr
||
sel
->
test_quick_select
(
tab
->
keys
,
sel
->
test_quick_select
(
join
->
thd
,
tab
->
keys
,
used_tables
&
~
current_map
,
(
join
->
select_options
&
OPTION_FOUND_ROWS
?
...
...
@@ -5828,7 +5829,8 @@ test_if_quick_select(JOIN_TAB *tab)
{
delete
tab
->
select
->
quick
;
tab
->
select
->
quick
=
0
;
return
tab
->
select
->
test_quick_select
(
tab
->
keys
,(
table_map
)
0
,
HA_POS_ERROR
);
return
tab
->
select
->
test_quick_select
(
tab
->
join
->
thd
,
tab
->
keys
,
(
table_map
)
0
,
HA_POS_ERROR
);
}
...
...
@@ -6921,7 +6923,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
For impossible ranges (like when doing a lookup on NULL on a NOT NULL
field, quick will contain an empty record set.
*/
if
(
!
(
select
->
quick
=
get_ft_or_quick_select_for_ref
(
table
,
tab
)))
if
(
!
(
select
->
quick
=
get_ft_or_quick_select_for_ref
(
tab
->
join
->
thd
,
table
,
tab
)))
goto
err
;
}
}
...
...
sql/sql_test.cc
View file @
461d1627
...
...
@@ -22,6 +22,7 @@
#include "sql_select.h"
#include <hash.h>
#include <thr_alarm.h>
#include <malloc.h>
/* Intern key cache variables */
extern
"C"
pthread_mutex_t
THR_LOCK_keycache
;
...
...
@@ -365,6 +366,32 @@ Next alarm time: %lu\n",
thd
->
proc_info
=
"malloc"
;
my_checkmalloc
();
TERMINATE
(
stdout
);
// Write malloc information
#ifdef HAVE_MALLINFO
struct
mallinfo
info
=
mallinfo
();
printf
(
"
\n
Memory status:
\n
\
Non-mmapped space allocated from system: %d
\n
\
Number of free chunks: %d
\n
\
Number of fastbin blocks: %d
\n
\
Number of mmapped regions: %d
\n
\
Space in mmapped regions: %d
\n
\
Maximum total allocated space: %d
\n
\
Space available in freed fastbin blocks: %d
\n
\
Total allocated space: %d
\n
\
Total free space: %d
\n
\
Top-most, releasable space: %d
\n
"
,
(
int
)
info
.
arena
,
(
int
)
info
.
ordblks
,
(
int
)
info
.
smblks
,
(
int
)
info
.
hblks
,
(
int
)
info
.
hblkhd
,
(
int
)
info
.
usmblks
,
(
int
)
info
.
fsmblks
,
(
int
)
info
.
uordblks
,
(
int
)
info
.
fordblks
,
(
int
)
info
.
keepcost
);
#endif
puts
(
""
);
if
(
thd
)
thd
->
proc_info
=
0
;
}
sql/sql_udf.cc
View file @
461d1627
...
...
@@ -128,7 +128,7 @@ void udf_init()
my_rwlock_init
(
&
THR_LOCK_udf
,
NULL
);
init_sql_alloc
(
&
mem
,
1024
,
0
);
init_sql_alloc
(
&
mem
,
UDF_ALLOC_BLOCK_SIZE
,
0
);
THD
*
new_thd
=
new
THD
;
if
(
!
new_thd
||
hash_init
(
&
udf_hash
,
system_charset_info
,
32
,
0
,
0
,
get_hash_key
,
NULL
,
0
))
...
...
sql/sql_update.cc
View file @
461d1627
...
...
@@ -152,7 +152,7 @@ int mysql_update(THD *thd,
table
->
used_keys
=
0
;
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
||
(
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
(
select
&&
select
->
check_quick
(
thd
,
safe_update
,
limit
))
||
!
limit
)
{
delete
select
;
free_underlaid_joins
(
thd
,
&
thd
->
lex
.
select_lex
);
...
...
sql/table.cc
View file @
461d1627
...
...
@@ -90,7 +90,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam
->
db_stat
=
db_stat
;
error
=
1
;
init_sql_alloc
(
&
outparam
->
mem_root
,
1024
,
0
);
init_sql_alloc
(
&
outparam
->
mem_root
,
TABLE_ALLOC_BLOCK_SIZE
,
0
);
MEM_ROOT
*
old_root
=
my_pthread_getspecific_ptr
(
MEM_ROOT
*
,
THR_MALLOC
);
my_pthread_setspecific_ptr
(
THR_MALLOC
,
&
outparam
->
mem_root
);
...
...
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