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
c0f04fa3
Commit
c0f04fa3
authored
Aug 13, 2012
by
Michael Widenius
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge
parents
c9b95de2
cee888ac
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
139 additions
and
29 deletions
+139
-29
client/mysqldump.c
client/mysqldump.c
+1
-1
dbug/dbug.c
dbug/dbug.c
+0
-3
mysql-test/suite/heap/heap.result
mysql-test/suite/heap/heap.result
+52
-0
mysql-test/suite/heap/heap.test
mysql-test/suite/heap/heap.test
+44
-0
plugin/semisync/semisync_master.cc
plugin/semisync/semisync_master.cc
+2
-1
sql/opt_range.cc
sql/opt_range.cc
+1
-2
sql/sql_table.cc
sql/sql_table.cc
+5
-4
storage/heap/hp_block.c
storage/heap/hp_block.c
+12
-11
storage/heap/hp_create.c
storage/heap/hp_create.c
+17
-6
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+1
-1
storage/maria/ma_delete.c
storage/maria/ma_delete.c
+2
-0
storage/maria/ma_write.c
storage/maria/ma_write.c
+2
-0
No files found.
client/mysqldump.c
View file @
c0f04fa3
...
...
@@ -4805,7 +4805,7 @@ static int add_slave_statements(void)
static
int
do_show_slave_status
(
MYSQL
*
mysql_con
)
{
MYSQL_RES
*
slave
;
MYSQL_RES
*
slave
=
0
;
const
char
*
comment_prefix
=
(
opt_slave_data
==
MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL
)
?
"-- "
:
""
;
if
(
mysql_query_with_error_report
(
mysql_con
,
&
slave
,
"SHOW SLAVE STATUS"
))
...
...
dbug/dbug.c
View file @
c0f04fa3
...
...
@@ -284,9 +284,6 @@ static int DoTrace(CODE_STATE *cs);
/* Test to see if file is writable */
#if defined(HAVE_ACCESS)
static
BOOLEAN
Writable
(
const
char
*
pathname
);
/* Change file owner and group */
static
void
ChangeOwner
(
CODE_STATE
*
cs
,
char
*
pathname
);
/* Allocate memory for runtime support */
#endif
static
void
DoPrefix
(
CODE_STATE
*
cs
,
uint
line
);
...
...
mysql-test/suite/heap/heap.result
View file @
c0f04fa3
...
...
@@ -738,3 +738,55 @@ SELECT c2 FROM t1;
c2
0
DROP TABLE t1;
CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100;
insert into t1 values(1);
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
1600 2400
drop table t1;
CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000;
insert into t1 values(1);
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
16000 24000
drop table t1;
CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000;
insert into t1 values(1);
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
48000 72000
drop table t1;
CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000;
insert into t1 values(1);
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
24000 36000
drop table t1;
create table t1 (c1 int, index(c1)) engine=heap max_rows=10000;
insert into t1 select rand(100000000);
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1;
insert into t1 select rand(100000000) from t1 limit 488;
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
16000 24000
insert into t1 select rand(100000000) from t1 limit 1;
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
33024 49024
insert into t1 select rand(100000000) from t1 limit 1000;
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
49024 73024
insert into t1 select rand(100000000) from t1;
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
data_length index_length
81024 121024
drop table t1;
mysql-test/suite/heap/heap.test
View file @
c0f04fa3
...
...
@@ -485,3 +485,47 @@ INSERT INTO t1 VALUES('', 0);
ALTER
TABLE
t1
MODIFY
c1
VARCHAR
(
101
);
SELECT
c2
FROM
t1
;
DROP
TABLE
t1
;
#
# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length
# and index_length are allocated.
# Result is different for 32 / 64 bit machines as pointer lengths are different
#
CREATE
TABLE
t1
(
a
int
,
index
(
a
))
engine
=
heap
min_rows
=
10
max_rows
=
100
;
insert
into
t1
values
(
1
);
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
drop
table
t1
;
CREATE
TABLE
t1
(
a
int
,
index
(
a
))
engine
=
heap
min_rows
=
10
max_rows
=
10000
;
insert
into
t1
values
(
1
);
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
drop
table
t1
;
CREATE
TABLE
t1
(
a
int
,
index
(
a
))
engine
=
heap
min_rows
=
3000
max_rows
=
3000
;
insert
into
t1
values
(
1
);
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
drop
table
t1
;
CREATE
TABLE
t1
(
a
int
,
index
(
a
))
engine
=
heap
max_rows
=
15000
;
insert
into
t1
values
(
1
);
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
drop
table
t1
;
create
table
t1
(
c1
int
,
index
(
c1
))
engine
=
heap
max_rows
=
10000
;
insert
into
t1
select
rand
(
100000000
);
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
insert
into
t1
select
rand
(
100000000
)
from
t1
limit
488
;
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
insert
into
t1
select
rand
(
100000000
)
from
t1
limit
1
;
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
insert
into
t1
select
rand
(
100000000
)
from
t1
limit
1000
;
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
insert
into
t1
select
rand
(
100000000
)
from
t1
;
select
data_length
,
index_length
from
information_schema
.
tables
where
table_schema
=
"test"
and
table_name
=
"t1"
;
drop
table
t1
;
plugin/semisync/semisync_master.cc
View file @
c0f04fa3
...
...
@@ -1049,10 +1049,11 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
ulong
log_file_len
=
0
;
ulong
packet_len
;
int
result
=
-
1
;
struct
timespec
start_ts
;
ulong
trc_level
=
trace_level_
;
LINT_INIT_STRUCT
(
start_ts
);
function_enter
(
kWho
);
assert
((
unsigned
char
)
event_buf
[
1
]
==
kPacketMagicNum
);
...
...
sql/opt_range.cc
View file @
c0f04fa3
...
...
@@ -2001,7 +2001,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
{
handler
*
save_file
=
file
,
*
org_file
;
my_bool
org_key_read
;
THD
*
thd
;
THD
*
thd
=
head
->
in_use
;
DBUG_ENTER
(
"QUICK_RANGE_SELECT::init_ror_merged_scan"
);
in_ror_merged_scan
=
1
;
...
...
@@ -2023,7 +2023,6 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
DBUG_RETURN
(
0
);
}
thd
=
head
->
in_use
;
if
(
!
(
file
=
head
->
file
->
clone
(
head
->
s
->
normalized_path
.
str
,
thd
->
mem_root
)))
{
/*
...
...
sql/sql_table.cc
View file @
c0f04fa3
...
...
@@ -1960,8 +1960,9 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
static
uint32
comment_length
(
THD
*
thd
,
uint32
comment_pos
,
const
char
**
comment_start
)
{
const
char
*
query
=
thd
->
query
();
const
char
*
query_end
=
query
+
thd
->
query_length
();
/* We use uchar * here to make array indexing portable */
const
uchar
*
query
=
(
uchar
*
)
thd
->
query
();
const
uchar
*
query_end
=
(
uchar
*
)
query
+
thd
->
query_length
();
const
uchar
*
const
state_map
=
thd
->
charset
()
->
state_map
;
for
(;
query
<
query_end
;
query
++
)
...
...
@@ -1975,12 +1976,12 @@ static uint32 comment_length(THD *thd, uint32 comment_pos,
state_map
[
static_cast
<
uchar
>
(
*
query
)]
!=
MY_LEX_LONG_COMMENT
||
query
[
1
]
!=
'*'
)
return
0
;
*
comment_start
=
query
;
*
comment_start
=
(
char
*
)
query
;
for
(
query
+=
3
;
query
<
query_end
;
query
++
)
{
if
(
query
[
-
1
]
==
'*'
&&
query
[
0
]
==
'/'
)
return
query
-
*
comment_start
+
1
;
return
(
char
*
)
query
-
*
comment_start
+
1
;
}
return
0
;
}
...
...
storage/heap/hp_block.c
View file @
c0f04fa3
...
...
@@ -64,18 +64,19 @@ int hp_get_new_block(HP_BLOCK *block, size_t *alloc_length)
break
;
/*
Allocate space for leaf block
plus space for upper level blocks up to
first level that has a free slot to put the pointer.
I
n some cases we actually allocate more then we need:
Consider e.g. a situation where we have one level 1 block and one level 0
block, the level 0 block is full and this function is called. We only
need a leaf block in this case. Nevertheless, we will get here with i=1
and will also allocate sizeof(HP_PTRS) for non-leaf block and will never
use this space
.
This doesn't add much overhead - with current values of sizeof(HP_PTRS)
and my_default_record_cache_size we get about 1/128 unused memory
.
Allocate space for leaf block
(data) plus space for upper level blocks
up to first level that has a free slot to put the pointer.
I
f this is a new level, we have to allocate pointers to all future
lower levels.
For example, for level 0, we allocate data for X rows.
When level 0 is full, we allocate data for HPTRS_IN_NODE + X rows.
Next time we allocate data for X rows
.
When level 1 is full, we allocate data for HPTRS_IN_NODE at level 2 and 1
+ X rows at level 0
.
*/
*
alloc_length
=
sizeof
(
HP_PTRS
)
*
i
+
block
->
records_in_block
*
block
->
recbuffer
;
*
alloc_length
=
(
sizeof
(
HP_PTRS
)
*
((
i
==
block
->
levels
)
?
i
:
i
-
1
)
+
block
->
records_in_block
*
block
->
recbuffer
);
if
(
!
(
root
=
(
HP_PTRS
*
)
my_malloc
(
*
alloc_length
,
MYF
(
MY_WME
))))
return
1
;
...
...
storage/heap/hp_create.c
View file @
c0f04fa3
...
...
@@ -245,21 +245,32 @@ static void init_block(HP_BLOCK *block, uint reclength, ulong min_records,
{
uint
i
,
recbuffer
,
records_in_block
;
max_records
=
max
(
min_records
,
max_records
);
/*
If not min_records and max_records are given, optimize for 1000 rows
*/
if
(
!
min_records
)
min_records
=
min
(
1000
,
max_records
);
if
(
!
max_records
)
max_records
=
1000
;
/* As good as quess as anything */
recbuffer
=
(
uint
)
(
reclength
+
sizeof
(
uchar
**
)
-
1
)
&
~
(
sizeof
(
uchar
**
)
-
1
);
records_in_block
=
max_records
/
10
;
max_records
=
max
(
min_records
,
1000
);
/*
We don't want too few records_in_block as otherwise the overhead of
of the HP_PTRS block will be too notable
*/
records_in_block
=
min
(
1000
,
max_records
);
records_in_block
=
max
(
1000
,
min_records
);
records_in_block
=
min
(
records_in_block
,
max_records
);
/* If big max_records is given, allocate bigger blocks */
records_in_block
=
max
(
records_in_block
,
max_records
/
10
);
/* We don't want too few blocks per row either */
if
(
records_in_block
<
10
)
records_in_block
=
10
;
/* The + 1 is there to ensure that we get at least 1 row per level */
recbuffer
=
(
uint
)
(
reclength
+
sizeof
(
uchar
**
)
-
1
)
&
~
(
sizeof
(
uchar
**
)
-
1
);
/*
Don't allocate more than my_default_record_cache_size per level.
The + 1 is there to ensure that we get at least 1 row per level (for
the exceptional case of very long rows)
*/
if
(
records_in_block
*
recbuffer
>
(
my_default_record_cache_size
-
sizeof
(
HP_PTRS
)
*
HP_MAX_LEVELS
))
records_in_block
=
(
my_default_record_cache_size
-
sizeof
(
HP_PTRS
)
*
...
...
storage/innobase/handler/ha_innodb.cc
View file @
c0f04fa3
...
...
@@ -11712,7 +11712,7 @@ static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
"trigger a readahead."
,
NULL
,
NULL
,
56
,
0
,
64
,
0
);
#ifdef UNIV_DEBUG
#ifdef UNIV_DEBUG
_never
static
MYSQL_SYSVAR_UINT
(
trx_rseg_n_slots_debug
,
trx_rseg_n_slots_debug
,
PLUGIN_VAR_RQCMDARG
,
"Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()"
,
...
...
storage/maria/ma_delete.c
View file @
c0f04fa3
...
...
@@ -163,6 +163,8 @@ my_bool _ma_ck_delete(MARIA_HA *info, MARIA_KEY *key)
MARIA_KEY
org_key
;
DBUG_ENTER
(
"_ma_ck_delete"
);
LINT_INIT_STRUCT
(
org_key
);
save_key_data
=
key
->
data
;
if
(
share
->
now_transactional
)
{
...
...
storage/maria/ma_write.c
View file @
c0f04fa3
...
...
@@ -478,6 +478,8 @@ static my_bool _ma_ck_write_btree_with_log(MARIA_HA *info, MARIA_KEY *key,
my_bool
transactional
=
share
->
now_transactional
;
DBUG_ENTER
(
"_ma_ck_write_btree_with_log"
);
LINT_INIT_STRUCT
(
org_key
);
if
(
transactional
)
{
/* Save original value as the key may change */
...
...
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