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
621be521
Commit
621be521
authored
Dec 17, 2001
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql into hundin.mysql.fi:/my/bk/mysql
parents
1808d80f
d7bd5868
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
31 deletions
+57
-31
innobase/dict/dict0dict.c
innobase/dict/dict0dict.c
+5
-3
innobase/dict/dict0mem.c
innobase/dict/dict0mem.c
+2
-2
innobase/include/dict0mem.h
innobase/include/dict0mem.h
+9
-13
innobase/row/row0mysql.c
innobase/row/row0mysql.c
+34
-9
sql/ha_innobase.cc
sql/ha_innobase.cc
+7
-4
No files found.
innobase/dict/dict0dict.c
View file @
621be521
...
...
@@ -455,7 +455,7 @@ dict_table_get(
mutex_exit
(
&
(
dict_sys
->
mutex
));
if
(
table
!=
NULL
)
{
if
(
table
->
stat_last_estimate_counter
==
(
ulint
)(
-
1
)
)
{
if
(
!
table
->
stat_initialized
)
{
dict_update_statistics
(
table
);
}
}
...
...
@@ -2614,7 +2614,9 @@ dict_update_statistics_low(
table
->
stat_sum_of_other_index_sizes
=
sum_of_index_sizes
-
index
->
stat_index_size
;
table
->
stat_last_estimate_counter
=
table
->
stat_modif_counter
;
table
->
stat_initialized
=
TRUE
;
table
->
stat_modified_counter
=
0
;
}
/*************************************************************************
...
...
innobase/dict/dict0mem.c
View file @
621be521
...
...
@@ -73,9 +73,9 @@ dict_mem_table_create(
table
->
does_not_fit_in_memory
=
FALSE
;
table
->
stat_
last_estimate_counter
=
(
ulint
)(
-
1
)
;
table
->
stat_
initialized
=
FALSE
;
table
->
stat_modif_counter
=
0
;
table
->
stat_modif
ied
_counter
=
0
;
mutex_create
(
&
(
table
->
autoinc_mutex
));
mutex_set_level
(
&
(
table
->
autoinc_mutex
),
SYNC_DICT_AUTOINC_MUTEX
);
...
...
innobase/include/dict0mem.h
View file @
621be521
...
...
@@ -348,20 +348,20 @@ struct dict_table_struct{
database pages */
ulint
stat_sum_of_other_index_sizes
;
/* other indexes in database pages */
ulint
stat_last_estimate_counter
;
/* when the estimates were last time
calculated; a value (ulint)-1 denotes that
they have not yet been calculated for this
table (or the counter has wrapped over) */
ulint
stat_modif_counter
;
ibool
stat_initialized
;
/* TRUE if statistics have
been calculated the first time
after database startup or table creation */
ulint
stat_modified_counter
;
/* when a row is inserted, updated, or deleted,
we add the row length to this number; we
calculate new estimates for the stat_...
values for the table and the indexes at an
interval of
DICT_STAT_CALCULATE_INTERVAL,
but for small tables more often,
also
interval of
2 GB or when about 1 / 16 of table
has been modified;
also
when the estimate operation is called
for MySQL SHOW TABLE STATUS; this counter
for MySQL SHOW TABLE STATUS; the counter is
reset to zero at statistics calculation;
this counter
is not protected by any latch, because this
is only used for heuristics */
/*----------------------*/
...
...
@@ -378,10 +378,6 @@ struct dict_table_struct{
};
#define DICT_TABLE_MAGIC_N 76333786
/* Statistics are calculated at least with this interval; see the struct
above */
#define DICT_STAT_CALCULATE_INTERVAL (UNIV_PAGE_SIZE * 8)
/* Data structure for a stored procedure */
struct
dict_proc_struct
{
mem_heap_t
*
heap
;
/* memory heap */
...
...
innobase/row/row0mysql.c
View file @
621be521
...
...
@@ -432,19 +432,24 @@ row_update_statistics_if_needed(
row_prebuilt_t
*
prebuilt
)
/* in: prebuilt struct */
{
ulint
counter
;
ulint
old_counter
;
counter
=
prebuilt
->
table
->
stat_modif_counter
;
counter
=
prebuilt
->
table
->
stat_modif
ied
_counter
;
counter
+=
prebuilt
->
mysql_row_len
;
prebuilt
->
table
->
stat_modif_counter
=
counter
;
/* Since the physical size of an InnoDB row is bigger than the
MySQL row len, we put a safety factor 2 below */
old_counter
=
prebuilt
->
table
->
stat_last_estimate_counter
;
counter
+=
2
*
prebuilt
->
mysql_row_len
;
if
(
counter
-
old_counter
>=
DICT_STAT_CALCULATE_INTERVAL
||
counter
-
old_counter
>=
(
UNIV_PAGE_SIZE
*
prebuilt
->
table
->
stat_clustered_index_size
/
2
))
{
prebuilt
->
table
->
stat_modified_counter
=
counter
;
/* Calculate new statistics if 1 / 16 of table has been modified
since the last time a statistics batch was run, or if
stat_modified_counter > 2 000 000 000 (to avoid wrap-around) */
if
(
counter
>
2000000000
||
((
ib_longlong
)
counter
>
(
UNIV_PAGE_SIZE
*
prebuilt
->
table
->
stat_clustered_index_size
)
/
16
))
{
dict_update_statistics
(
prebuilt
->
table
);
}
...
...
@@ -1019,6 +1024,26 @@ row_create_table_for_mysql(
os_event_set
(
srv_lock_timeout_thread_event
);
}
keywordlen
=
ut_strlen
(
"innodb_mem_validate"
);
if
(
namelen
>=
keywordlen
&&
0
==
ut_memcmp
(
table
->
name
+
namelen
-
keywordlen
,
"innodb_mem_validate"
,
keywordlen
))
{
/* We define here a debugging feature intended for
developers */
printf
(
"Validating InnoDB memory:
\n
"
"to use this feature you must compile InnoDB with
\n
"
"UNIV_MEM_DEBUG defined in univ.i and the server must be
\n
"
"quiet because allocation from a mem heap is not protected
\n
"
"by any semaphore.
\n
"
);
ut_a
(
mem_validate
());
printf
(
"Memory validated
\n
"
);
}
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
...
...
sql/ha_innobase.cc
View file @
621be521
...
...
@@ -3035,15 +3035,18 @@ ha_innobase::estimate_number_of_rows(void)
DBUG_ENTER
(
"info"
);
dict_update_statistics
(
prebuilt
->
table
);
index
=
dict_table_get_first_index_noninline
(
prebuilt
->
table
);
data_file_length
=
((
ulonglong
)
index
->
stat_n_leaf_pages
)
*
UNIV_PAGE_SIZE
;
/* Calculate a minimum length for a clustered index record */
estimate
=
data_file_length
/
dict_index_calc_min_rec_len
(
index
);
/* Calculate a minimum length for a clustered index record and from
that an upper bound for the number of rows. Since we only calculate
new statistics in row0mysql.c when a tablehas grown
by a threshold factor, we must add a safety factor 2 in front
of the formula below. */
estimate
=
2
*
data_file_length
/
dict_index_calc_min_rec_len
(
index
);
if
(
prebuilt
->
trx
)
{
prebuilt
->
trx
->
op_info
=
""
;
...
...
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