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
e65ddf3f
Commit
e65ddf3f
authored
Nov 20, 2002
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to optimize the cache buffer size needed for bulk_insert
Fix for shutdown on Mac OS X
parent
f9e6ae6f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
48 additions
and
18 deletions
+48
-18
include/my_tree.h
include/my_tree.h
+2
-0
myisam/mi_write.c
myisam/mi_write.c
+2
-1
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+2
-2
mysql-test/t/bdb.test
mysql-test/t/bdb.test
+1
-1
mysys/tree.c
mysys/tree.c
+5
-3
sql/mysql_priv.h
sql/mysql_priv.h
+2
-1
sql/mysqld.cc
sql/mysqld.cc
+19
-2
sql/sql_insert.cc
sql/sql_insert.cc
+7
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-4
sql/table.cc
sql/table.cc
+2
-1
sql/table.h
sql/table.h
+1
-0
No files found.
include/my_tree.h
View file @
e65ddf3f
...
...
@@ -76,6 +76,8 @@ int tree_walk(TREE *tree,tree_walk_action action,
void
*
argument
,
TREE_WALK
visit
);
int
tree_delete
(
TREE
*
tree
,
void
*
key
);
#define TREE_ELEMENT_EXTRA_SIZE (sizeof(TREE_ELEMENT) + sizeof(void*))
#ifdef __cplusplus
}
#endif
...
...
myisam/mi_write.c
View file @
e65ddf3f
...
...
@@ -842,8 +842,9 @@ int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size)
{
params
->
info
=
info
;
params
->
keynr
=
i
;
/* Only allocate a 16'th of the buffer at a time */
init_tree
(
&
info
->
bulk_insert
[
i
],
cache_size
/
num_keys
/
4
+
10
,
cache_size
/
num_keys
/
16
+
10
,
cache_size
/
num_keys
,
0
,
(
qsort_cmp2
)
keys_compare
,
0
,
(
tree_element_free
)
keys_free
,
(
void
*
)
params
++
);
...
...
mysql-test/r/bdb.result
View file @
e65ddf3f
...
...
@@ -133,11 +133,11 @@ id parent_id level
1202 107 2
1204 107 2
update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102;
select * from t1 where parent_id=102
order by parent_id,id
;
id parent_id level
1008 102 2
1015 102 2
1010 102 2
1015 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 Using where; Using index
...
...
mysql-test/t/bdb.test
View file @
e65ddf3f
...
...
@@ -39,7 +39,7 @@ select * from t1;
update
ignore
t1
set
id
=
id
+
1
;
# This will change all rows
select
*
from
t1
;
update
ignore
t1
set
id
=
1023
where
id
=
1010
;
select
*
from
t1
where
parent_id
=
102
;
select
*
from
t1
where
parent_id
=
102
order
by
parent_id
,
id
;
explain
select
level
from
t1
where
level
=
1
;
explain
select
level
,
id
from
t1
where
level
=
1
;
explain
select
level
,
id
,
parent_id
from
t1
where
level
=
1
;
...
...
mysys/tree.c
View file @
e65ddf3f
...
...
@@ -45,7 +45,8 @@
#define BLACK 1
#define RED 0
#define DEFAULT_ALLOC_SIZE (8192-MALLOC_OVERHEAD)
#define DEFAULT_ALLOC_SIZE 8192
#define DEFAULT_ALIGN_SIZE 8192
static
void
delete_tree_element
(
TREE
*
,
TREE_ELEMENT
*
);
static
int
tree_walk_left_root_right
(
TREE
*
,
TREE_ELEMENT
*
,
...
...
@@ -72,8 +73,9 @@ void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
DBUG_ENTER
(
"init_tree"
);
DBUG_PRINT
(
"enter"
,(
"tree: %lx size: %d"
,
tree
,
size
));
if
(
!
default_alloc_size
)
if
(
default_alloc_size
<
DEFAULT_ALLOC_SIZE
)
default_alloc_size
=
DEFAULT_ALLOC_SIZE
;
default_alloc_size
=
MY_ALIGN
(
default_alloc_size
,
DEFAULT_ALIGN_SIZE
);
bzero
((
gptr
)
&
tree
->
null_element
,
sizeof
(
tree
->
null_element
));
tree
->
root
=
&
tree
->
null_element
;
tree
->
compare
=
compare
;
...
...
sql/mysql_priv.h
View file @
e65ddf3f
...
...
@@ -83,6 +83,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
*/
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (16L*1024*1024)
#define MIN_ROWS_TO_USE_TABLE_CACHE 100
#define MIN_ROWS_TO_USE_BULK_INSERT 100
/*
The following is used to decide if MySQL should use table scanning
...
...
@@ -707,7 +708,7 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list);
/* old unireg functions */
void
unireg_init
(
ulong
options
);
void
unireg_end
(
int
signal
);
void
unireg_end
(
void
);
int
rea_create_table
(
my_string
file_name
,
HA_CREATE_INFO
*
create_info
,
List
<
create_field
>
&
create_field
,
uint
key_count
,
KEY
*
key_info
);
...
...
sql/mysqld.cc
View file @
e65ddf3f
...
...
@@ -764,7 +764,7 @@ static void __cdecl kill_server(int sig_ptr)
if
(
sig
!=
MYSQL_KILL_SIGNAL
&&
sig
!=
0
)
unireg_abort
(
1
);
/* purecov: inspected */
else
unireg_end
(
0
);
unireg_end
();
pthread_exit
(
0
);
/* purecov: deadcode */
RETURN_FROM_KILL_SERVER
;
}
...
...
@@ -803,12 +803,29 @@ extern "C" sig_handler print_signal_warning(int sig)
#endif
}
/*
cleanup all memory and end program nicely
SYNOPSIS
unireg_end()
NOTES
This function never returns.
If SIGNALS_DONT_BREAK_READ is defined, this function is called
by the main thread. To get MySQL to shut down nicely in this case
(Mac OS X) we have to call exit() instead if pthread_exit().
*/
void
unireg_end
(
int
signal_number
__attribute__
((
unused
))
)
void
unireg_end
(
void
)
{
clean_up
();
my_thread_end
();
#ifdef SIGNALS_DONT_BREAK_READ
exit
(
0
);
#else
pthread_exit
(
0
);
// Exit is in main thread
#endif
}
...
...
sql/sql_insert.cc
View file @
e65ddf3f
...
...
@@ -194,15 +194,19 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
thd
->
proc_info
=
"update"
;
if
(
duplic
==
DUP_IGNORE
||
duplic
==
DUP_REPLACE
)
table
->
file
->
extra
(
HA_EXTRA_IGNORE_DUP_KEY
);
if
((
bulk_insert
=
(
values_list
.
elements
>
1
&&
if
((
bulk_insert
=
(
values_list
.
elements
>
=
MIN_ROWS_TO_USE_BULK_INSERT
&&
lock_type
!=
TL_WRITE_DELAYED
&&
!
(
specialflag
&
SPECIAL_SAFE_MODE
))))
{
table
->
file
->
extra_opt
(
HA_EXTRA_WRITE_CACHE
,
thd
->
variables
.
read_buff_size
);
min
(
thd
->
variables
.
read_buff_size
,
table
->
avg_row_length
*
values_list
.
elements
));
if
(
thd
->
variables
.
bulk_insert_buff_size
)
table
->
file
->
extra_opt
(
HA_EXTRA_BULK_INSERT_BEGIN
,
thd
->
variables
.
bulk_insert_buff_size
);
min
(
thd
->
variables
.
bulk_insert_buff_size
,
(
table
->
total_key_length
+
table
->
keys
*
TREE_ELEMENT_EXTRA_SIZE
)
*
values_list
.
elements
));
table
->
bulk_insert
=
1
;
}
...
...
sql/sql_yacc.yy
View file @
e65ddf3f
...
...
@@ -3107,12 +3107,13 @@ ident:
IDENT { $$=$1; }
| keyword
{
LEX *lex;
$$.str=
sql_
strmake($1.str,$1.length);
LEX *lex
= Lex
;
$$.str=
lex->thd->
strmake($1.str,$1.length);
$$.length=$1.length;
if (
(lex=Lex)
->next_state != STATE_END)
if (
lex
->next_state != STATE_END)
lex->next_state=STATE_OPERATOR_OR_IDENT;
};
}
;
ident_or_text:
ident { $$=$1;}
...
...
sql/table.cc
View file @
e65ddf3f
...
...
@@ -143,7 +143,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
goto
err_not_open
;
/* purecov: inspected */
bzero
((
char
*
)
keyinfo
,
n_length
);
outparam
->
key_info
=
keyinfo
;
outparam
->
max_key_length
=
0
;
outparam
->
max_key_length
=
outparam
->
total_key_length
=
0
;
key_part
=
(
KEY_PART_INFO
*
)
(
keyinfo
+
keys
);
strpos
=
disk_buff
+
6
;
...
...
@@ -201,6 +201,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
}
set_if_bigger
(
outparam
->
max_key_length
,
keyinfo
->
key_length
+
keyinfo
->
key_parts
);
outparam
->
total_key_length
+=
keyinfo
->
key_length
;
if
(
keyinfo
->
flags
&
HA_NOSAME
)
set_if_bigger
(
outparam
->
max_unique_length
,
keyinfo
->
key_length
);
}
...
...
sql/table.h
View file @
e65ddf3f
...
...
@@ -58,6 +58,7 @@ struct st_table {
uint
reclength
;
/* Recordlength */
uint
rec_buff_length
;
uint
keys
,
key_parts
,
primary_key
,
max_key_length
,
max_unique_length
;
uint
total_key_length
;
uint
uniques
;
uint
null_fields
;
/* number of null fields */
uint
blob_fields
;
/* number of blob fields */
...
...
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