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
172356b0
Commit
172356b0
authored
Sep 07, 2010
by
Michael Widenius
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge
parents
7027c7fa
89e62085
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
570 additions
and
337 deletions
+570
-337
mysql-test/lib/My/ConfigFactory.pm
mysql-test/lib/My/ConfigFactory.pm
+1
-1
mysql-test/lib/mtr_cases.pm
mysql-test/lib/mtr_cases.pm
+1
-1
mysql-test/lib/v1/mysql-test-run.pl
mysql-test/lib/v1/mysql-test-run.pl
+1
-1
mysql-test/suite/pbxt/r/range.result
mysql-test/suite/pbxt/r/range.result
+8
-8
mysql-test/suite/pbxt/t/range.test
mysql-test/suite/pbxt/t/range.test
+5
-0
sql/mysqld.cc
sql/mysqld.cc
+14
-10
storage/maria/ha_maria.cc
storage/maria/ha_maria.cc
+10
-1
storage/maria/ma_bitmap.c
storage/maria/ma_bitmap.c
+11
-3
storage/maria/ma_blockrec.c
storage/maria/ma_blockrec.c
+2
-1
storage/maria/ma_check.c
storage/maria/ma_check.c
+16
-12
storage/maria/ma_delete.c
storage/maria/ma_delete.c
+164
-59
storage/maria/ma_key_recover.c
storage/maria/ma_key_recover.c
+167
-98
storage/maria/ma_key_recover.h
storage/maria/ma_key_recover.h
+11
-2
storage/maria/ma_loghandler.h
storage/maria/ma_loghandler.h
+18
-7
storage/maria/ma_open.c
storage/maria/ma_open.c
+1
-0
storage/maria/ma_page.c
storage/maria/ma_page.c
+44
-19
storage/maria/ma_recovery.c
storage/maria/ma_recovery.c
+1
-0
storage/maria/ma_rt_key.c
storage/maria/ma_rt_key.c
+2
-1
storage/maria/ma_rt_split.c
storage/maria/ma_rt_split.c
+6
-19
storage/maria/ma_write.c
storage/maria/ma_write.c
+83
-94
storage/maria/maria_def.h
storage/maria/maria_def.h
+3
-0
storage/maria/trnman.c
storage/maria/trnman.c
+1
-0
No files found.
mysql-test/lib/My/ConfigFactory.pm
View file @
172356b0
...
...
@@ -606,7 +606,7 @@ sub new_config {
# add auto-options
$config
->
insert
('
OPT
',
'
port
'
=>
sub
{
fix_port
(
$self
,
$config
)
});
$config
->
insert
('
OPT
',
'
vardir
'
=>
sub
{
shift
->
{
ARGS
}
->
{
vardir
}
});
$config
->
insert
('
OPT
',
'
vardir
'
=>
sub
{
$self
->
{
ARGS
}
->
{
vardir
}
});
{
# Run pre rules
...
...
mysql-test/lib/mtr_cases.pm
View file @
172356b0
...
...
@@ -687,7 +687,7 @@ sub process_opts {
}
if
(
@plugins
)
{
my
$sep
=
(
IS_WIN
32PERL
)
?
'
;
'
:
'
:
';
my
$sep
=
(
IS_WIN
DOWS
)
?
'
;
'
:
'
:
';
push
@
{
$tinfo
->
{
$opt_name
}},
"
--plugin-load=
"
.
join
(
$sep
,
@plugins
);
}
}
...
...
mysql-test/lib/v1/mysql-test-run.pl
View file @
172356b0
...
...
@@ -2959,7 +2959,7 @@ sub run_benchmarks ($) {
if
(
!
$benchmark
)
{
mtr_add_arg
(
$args
,
"
--log
");
mtr_add_arg
(
$args
,
"
--
general-
log
");
mtr_run
("
$glob_mysql_bench_dir
/run-all-tests
",
$args
,
"",
"",
"",
"");
# FIXME check result code?!
}
...
...
mysql-test/suite/pbxt/r/range.result
View file @
172356b0
...
...
@@ -422,20 +422,20 @@ test.t1 analyze status OK
test.t2 analyze status OK
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL
1
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
1
1 SIMPLE t1 range uid_index uid_index 4 NULL
#
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
#
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL
1
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
1
1 SIMPLE t1 range uid_index uid_index 4 NULL
#
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
#
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL
2
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
1
1 SIMPLE t1 range uid_index uid_index 4 NULL
#
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
#
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL
2
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
1
1 SIMPLE t1 range uid_index uid_index 4 NULL
#
Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid
#
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id name uid id name uid
1001 A 1 1001 A 1
...
...
mysql-test/suite/pbxt/t/range.test
View file @
172356b0
...
...
@@ -383,9 +383,14 @@ analyze table t1,t2;
# This part doesn't make sense for pbxt as the result may vary becasue
# records_in_range() gives same results for t1 and t2.
# Added straight_join to get predictable results
--
replace_column
9
#
explain
select
straight_join
*
from
t1
,
t2
where
t1
.
uid
=
t2
.
uid
AND
t1
.
uid
>
0
;
--
replace_column
9
#
explain
select
straight_join
*
from
t1
,
t2
where
t1
.
uid
=
t2
.
uid
AND
t2
.
uid
>
0
;
--
replace_column
9
#
explain
select
straight_join
*
from
t1
,
t2
where
t1
.
uid
=
t2
.
uid
AND
t1
.
uid
!=
0
;
--
replace_column
9
#
explain
select
straight_join
*
from
t1
,
t2
where
t1
.
uid
=
t2
.
uid
AND
t2
.
uid
!=
0
;
select
*
from
t1
,
t2
where
t1
.
uid
=
t2
.
uid
AND
t1
.
uid
>
0
;
...
...
sql/mysqld.cc
View file @
172356b0
...
...
@@ -3070,7 +3070,20 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
}
else
{
if
(
!
thd
->
main_da
.
is_error
())
// Return only first message
if
(
thd
->
main_da
.
is_ok
()
&&
!
thd
->
main_da
.
can_overwrite_status
)
{
/*
Client has already got ok packet and we are not in net_flush(), so
we write a message to error log.
This could happen if we get an error in implicit commit.
This should never happen in normal operation, so lets
assert here in debug builds.
*/
DBUG_ASSERT
(
0
);
func
=
sql_print_error
;
MyFlags
|=
ME_NOREFRESH
;
}
else
if
(
!
thd
->
main_da
.
is_error
())
// Return only first message
{
thd
->
main_da
.
set_error_status
(
thd
,
error
,
str
);
}
...
...
@@ -4185,7 +4198,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
unireg_abort
(
1
);
}
#ifdef WITH_CSV_STORAGE_ENGINE
if
(
opt_bootstrap
)
log_output_options
=
LOG_FILE
;
else
...
...
@@ -4219,10 +4231,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
logger
.
set_handlers
(
LOG_FILE
,
opt_slow_log
?
log_output_options
:
LOG_NONE
,
opt_log
?
log_output_options
:
LOG_NONE
);
}
#else
logger
.
set_handlers
(
LOG_FILE
,
opt_slow_log
?
LOG_FILE
:
LOG_NONE
,
opt_log
?
LOG_FILE
:
LOG_NONE
);
#endif
/*
Check that the default storage engine is actually available.
...
...
@@ -6298,13 +6306,11 @@ each time the SQL thread starts.",
"Log some extra information to update log. Please note that this option "
"is deprecated; see --log-short-format option."
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#ifdef WITH_CSV_STORAGE_ENGINE
{
"log-output"
,
OPT_LOG_OUTPUT
,
"Syntax: log-output[=value[,value...]], where
\"
value
\"
could be TABLE, "
"FILE or NONE."
,
&
log_output_str
,
&
log_output_str
,
0
,
GET_STR
,
OPT_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#endif
{
"log-queries-not-using-indexes"
,
OPT_LOG_QUERIES_NOT_USING_INDEXES
,
"Log queries that are executed without benefit of any index to the slow log if it is open."
,
&
opt_log_queries_not_using_indexes
,
&
opt_log_queries_not_using_indexes
,
...
...
@@ -8639,7 +8645,6 @@ mysqld_get_one_option(int optid,
WARN_DEPRECATED
(
NULL
,
"7.0"
,
"--log_slow_queries"
,
"'--slow_query_log'/'--log-slow-file'"
);
opt_slow_log
=
1
;
break
;
#ifdef WITH_CSV_STORAGE_ENGINE
case
OPT_LOG_OUTPUT
:
{
if
(
!
argument
||
!
argument
[
0
])
...
...
@@ -8657,7 +8662,6 @@ mysqld_get_one_option(int optid,
}
break
;
}
#endif
case
OPT_EVENT_SCHEDULER
:
#ifndef HAVE_EVENT_SCHEDULER
sql_perror
(
"Event scheduler is not supported in embedded build."
);
...
...
storage/maria/ha_maria.cc
View file @
172356b0
...
...
@@ -750,8 +750,11 @@ static int maria_create_trn_for_mysql(MARIA_HA *info)
thd
->
query_length
());
}
else
{
DBUG_PRINT
(
"info"
,
(
"lock_type: %d trnman_flags: %u"
,
info
->
lock_type
,
trnman_get_flags
(
trn
)));
/* QQ */
info
->
lock_type
,
trnman_get_flags
(
trn
)));
}
#endif
DBUG_RETURN
(
0
);
}
...
...
@@ -2347,6 +2350,12 @@ int ha_maria::extra(enum ha_extra_function operation)
int
ha_maria
::
reset
(
void
)
{
if
(
file
->
trn
)
{
/* Next statement is a new statement. Ensure it's logged */
trnman_set_flags
(
file
->
trn
,
trnman_get_flags
(
file
->
trn
)
&
~
TRN_STATE_INFO_LOGGED
);
}
return
maria_reset
(
file
);
}
...
...
storage/maria/ma_bitmap.c
View file @
172356b0
...
...
@@ -1875,6 +1875,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
uint
offset_page
,
offset
,
tmp
,
org_tmp
;
uchar
*
data
;
DBUG_ENTER
(
"set_page_bits"
);
DBUG_ASSERT
(
fill_pattern
<=
7
);
bitmap_page
=
page
-
page
%
bitmap
->
pages_covered
;
if
(
bitmap_page
!=
bitmap
->
page
&&
...
...
@@ -2296,9 +2297,16 @@ my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks)
The page has all bits set; The following test is an optimization
to not set the bits to the same value as before.
*/
if
(
bits
!=
current_bitmap_value
&&
set_page_bits
(
info
,
bitmap
,
block
->
page
,
bits
))
goto
err
;
if
(
bits
!=
current_bitmap_value
)
{
if
(
set_page_bits
(
info
,
bitmap
,
block
->
page
,
bits
))
goto
err
;
}
else
{
DBUG_ASSERT
(
current_bitmap_value
==
_ma_bitmap_get_page_bits
(
info
,
bitmap
,
block
->
page
));
}
}
else
if
(
!
(
block
->
used
&
BLOCKUSED_USED
)
&&
_ma_bitmap_reset_full_page_bits
(
info
,
bitmap
,
...
...
storage/maria/ma_blockrec.c
View file @
172356b0
...
...
@@ -1990,7 +1990,8 @@ static my_bool write_tail(MARIA_HA *info,
block
->
empty_space
=
(
enough_free_entries
(
row_pos
.
buff
,
share
->
block_size
,
1
+
share
->
base
.
blobs
)
?
empty_space
:
0
);
block
->
used
=
BLOCKUSED_USED
|
BLOCKUSED_TAIL
;
/* Keep BLOCKUSED_USE_ORG_BITMAP */
block
->
used
|=
BLOCKUSED_USED
|
BLOCKUSED_TAIL
;
/* Increase data file size, if extended */
position
=
(
my_off_t
)
block
->
page
*
block_size
;
...
...
storage/maria/ma_check.c
View file @
172356b0
...
...
@@ -136,11 +136,13 @@ void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info)
Set up transaction handler so that we can see all rows. When rows is read
we will check the found id against param->max_tried
*/
if
(
!
ma_control_file_inited
())
param
->
max_trid
=
0
;
/* Give warning for first trid found */
else
param
->
max_trid
=
max_trid_in_system
();
if
(
param
->
max_trid
==
0
)
{
if
(
!
ma_control_file_inited
())
param
->
max_trid
=
0
;
/* Give warning for first trid found */
else
param
->
max_trid
=
max_trid_in_system
();
}
maria_ignore_trids
(
info
);
}
...
...
@@ -867,7 +869,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
llstr
(
anc_page
->
pos
,
llbuff
));
}
if
(
anc_page
->
size
>
(
uint
)
keyinfo
->
block_length
-
KEYPAGE_CHECKSUM_SIZE
)
if
(
anc_page
->
size
>
share
->
max_index_block_size
)
{
_ma_check_print_error
(
param
,
"Page at %s has impossible (too big) pagelength"
,
...
...
@@ -2325,11 +2327,13 @@ static int initialize_variables_for_repair(HA_CHECK *param,
}
/* Set up transaction handler so that we can see all rows */
if
(
!
ma_control_file_inited
())
param
->
max_trid
=
0
;
/* Give warning for first trid found */
else
param
->
max_trid
=
max_trid_in_system
();
if
(
param
->
max_trid
==
0
)
{
if
(
!
ma_control_file_inited
())
param
->
max_trid
=
0
;
/* Give warning for first trid found */
else
param
->
max_trid
=
max_trid_in_system
();
}
maria_ignore_trids
(
info
);
/* Don't write transid's during repair */
maria_versioning
(
info
,
0
);
...
...
@@ -5609,7 +5613,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
a_length
+=
t_length
;
_ma_store_page_used
(
share
,
anc_buff
,
a_length
);
key_block
->
end_pos
+=
t_length
;
if
(
a_length
<=
(
uint
)
(
keyinfo
->
block_length
-
KEYPAGE_CHECKSUM_SIZE
)
)
if
(
a_length
<=
share
->
max_index_block_size
)
{
MARIA_KEY
tmp_key2
;
tmp_key2
.
data
=
key_block
->
lastkey
;
...
...
storage/maria/ma_delete.c
View file @
172356b0
This diff is collapsed.
Click to expand it.
storage/maria/ma_key_recover.c
View file @
172356b0
This diff is collapsed.
Click to expand it.
storage/maria/ma_key_recover.h
View file @
172356b0
...
...
@@ -64,17 +64,26 @@ extern my_bool write_hook_for_undo_key_delete(enum translog_record_type type,
TRN
*
trn
,
MARIA_HA
*
tbl_info
,
LSN
*
lsn
,
void
*
hook_arg
);
my_bool
_ma_log_prefix
(
MARIA_PAGE
*
page
,
uint
changed_length
,
int
move_length
);
my_bool
_ma_log_prefix
(
MARIA_PAGE
*
page
,
uint
changed_length
,
int
move_length
,
enum
en_key_debug
debug_marker
);
my_bool
_ma_log_suffix
(
MARIA_PAGE
*
page
,
uint
org_length
,
uint
new_length
);
my_bool
_ma_log_add
(
MARIA_PAGE
*
page
,
uint
buff_length
,
uchar
*
key_pos
,
uint
changed_length
,
int
move_length
,
my_bool
handle_overflow
);
my_bool
_ma_log_delete
(
MARIA_PAGE
*
page
,
const
uchar
*
key_pos
,
uint
changed_length
,
uint
move_length
);
uint
changed_length
,
uint
move_length
,
uint
append_length
,
enum
en_key_debug
debug_marker
);
my_bool
_ma_log_change
(
MARIA_PAGE
*
page
,
const
uchar
*
key_pos
,
uint
length
,
enum
en_key_debug
debug_marker
);
my_bool
_ma_log_new
(
MARIA_PAGE
*
page
,
my_bool
root_page
);
#ifdef EXTRA_DEBUG_KEY_CHANGES
void
_ma_log_key_changes
(
MARIA_PAGE
*
ma_page
,
LEX_CUSTRING
*
log_array
,
uchar
*
log_pos
,
uint
*
changed_length
,
uint
*
translog_parts
);
#else
#define _ma_log_key_changes(A,B,C,D,E)
#endif
uint
_ma_apply_redo_index_new_page
(
MARIA_HA
*
info
,
LSN
lsn
,
const
uchar
*
header
,
uint
length
);
...
...
storage/maria/ma_loghandler.h
View file @
172356b0
...
...
@@ -172,13 +172,24 @@ enum en_key_op
enum
en_key_debug
{
KEY_OP_DEBUG_RTREE_COMBINE
,
KEY_OP_DEBUG_RTREE_SPLIT
,
KEY_OP_DEBUG_RTREE_SET_KEY
,
KEY_OP_DEBUG_FATHER_CHANGED_1
,
KEY_OP_DEBUG_FATHER_CHANGED_2
,
KEY_OP_DEBUG_LOG_SPLIT
,
KEY_OP_DEBUG_LOG_ADD
KEY_OP_DEBUG_RTREE_COMBINE
,
/* 0 */
KEY_OP_DEBUG_RTREE_SPLIT
,
/* 1 */
KEY_OP_DEBUG_RTREE_SET_KEY
,
/* 2 */
KEY_OP_DEBUG_FATHER_CHANGED_1
,
/* 3 */
KEY_OP_DEBUG_FATHER_CHANGED_2
,
/* 4 */
KEY_OP_DEBUG_LOG_SPLIT
,
/* 5 */
KEY_OP_DEBUG_LOG_ADD
,
/* 6 */
KEY_OP_DEBUG_LOG_PREFIX_1
,
/* 7 */
KEY_OP_DEBUG_LOG_PREFIX_2
,
/* 8 */
KEY_OP_DEBUG_LOG_PREFIX_3
,
/* 9 */
KEY_OP_DEBUG_LOG_PREFIX_4
,
/* 10 */
KEY_OP_DEBUG_LOG_PREFIX_5
,
/* 11 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_1
,
/* 12 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_2
,
/* 13 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_3
,
/* 14 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_RT
,
/* 15 */
KEY_OP_DEBUG_LOG_DEL_PREFIX
,
/* 16 */
KEY_OP_DEBUG_LOG_MIDDLE
/* 17 */
};
...
...
storage/maria/ma_open.c
View file @
172356b0
...
...
@@ -550,6 +550,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
strmov
(
share
->
open_file_name
.
str
,
name
);
share
->
block_size
=
share
->
base
.
block_size
;
/* Convenience */
share
->
max_index_block_size
=
share
->
block_size
-
KEYPAGE_CHECKSUM_SIZE
;
{
HA_KEYSEG
*
pos
=
share
->
keyparts
;
uint32
ftkey_nr
=
1
;
...
...
storage/maria/ma_page.c
View file @
172356b0
...
...
@@ -59,6 +59,7 @@ void _ma_page_setup(MARIA_PAGE *page, MARIA_HA *info,
page
->
buff
=
buff
;
page
->
pos
=
pos
;
page
->
size
=
_ma_get_page_used
(
share
,
buff
);
page
->
org_size
=
page
->
size
;
page
->
flag
=
_ma_get_keypage_flag
(
share
,
buff
);
page
->
node
=
((
page
->
flag
&
KEYPAGE_FLAG_ISNOD
)
?
share
->
base
.
key_reflength
:
0
);
...
...
@@ -68,7 +69,7 @@ void _ma_page_setup(MARIA_PAGE *page, MARIA_HA *info,
void
page_cleanup
(
MARIA_SHARE
*
share
,
MARIA_PAGE
*
page
)
{
uint
length
=
page
->
size
;
DBUG_ASSERT
(
length
<=
block_size
-
KEYPAGE_CHECKSUM_SIZE
);
DBUG_ASSERT
(
length
<=
share
->
max_index_block_size
);
bzero
(
page
->
buff
+
length
,
share
->
block_size
-
length
);
}
#endif
...
...
@@ -103,7 +104,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
MARIA_SHARE
*
share
=
info
->
s
;
uint
block_size
=
share
->
block_size
;
DBUG_ENTER
(
"_ma_fetch_keypage"
);
DBUG_PRINT
(
"enter"
,(
"p
os: %ld"
,
(
long
)
pos
));
DBUG_PRINT
(
"enter"
,(
"p
age: %lu"
,
(
ulong
)
(
pos
/
block_size
)
));
tmp
=
pagecache_read
(
share
->
pagecache
,
&
share
->
kfile
,
(
pgcache_page_no_t
)
(
pos
/
block_size
),
level
,
buff
,
...
...
@@ -142,6 +143,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
page
->
buff
=
tmp
;
page
->
pos
=
pos
;
page
->
size
=
_ma_get_page_used
(
share
,
tmp
);
page
->
org_size
=
page
->
size
;
/* For debugging */
page
->
flag
=
_ma_get_keypage_flag
(
share
,
tmp
);
page
->
node
=
((
page
->
flag
&
KEYPAGE_FLAG_ISNOD
)
?
share
->
base
.
key_reflength
:
0
);
...
...
@@ -149,7 +151,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
#ifdef EXTRA_DEBUG
{
uint
page_size
=
page
->
size
;
if
(
page_size
<
4
||
page_size
>
block_size
||
if
(
page_size
<
4
||
page_size
>
share
->
max_index_
block_size
||
_ma_get_keynr
(
share
,
tmp
)
!=
keyinfo
->
key_nr
)
{
DBUG_PRINT
(
"error"
,(
"page %lu had wrong page length: %u keynr: %u"
,
...
...
@@ -159,7 +161,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
info
->
last_keypage
=
HA_OFFSET_ERROR
;
maria_print_error
(
share
,
HA_ERR_CRASHED
);
my_errno
=
HA_ERR_CRASHED
;
tmp
=
0
;
DBUG_RETURN
(
1
)
;
}
}
#endif
...
...
@@ -179,6 +181,13 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
MARIA_PINNED_PAGE
page_link
;
DBUG_ENTER
(
"_ma_write_keypage"
);
/*
The following ensures that for transactional tables we have logged
all changes that changes the page size (as the logging code sets
page->org_size)
*/
DBUG_ASSERT
(
!
share
->
now_transactional
||
page
->
size
==
page
->
org_size
);
#ifdef EXTRA_DEBUG
/* Safety check */
{
uint
page_length
,
nod_flag
;
...
...
@@ -193,7 +202,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
(
page
->
pos
&
(
maria_block_size
-
1
)))
{
DBUG_PRINT
(
"error"
,(
"Trying to write inside key status region: "
"key_start: %lu length: %lu page: %lu"
,
"key_start: %lu length: %lu page
_pos
: %lu"
,
(
long
)
share
->
base
.
keystart
,
(
long
)
share
->
state
.
state
.
key_file_length
,
(
long
)
page
->
pos
));
...
...
@@ -201,7 +210,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
DBUG_ASSERT
(
0
);
DBUG_RETURN
(
1
);
}
DBUG_PRINT
(
"page"
,(
"write page at: %lu"
,(
long
)
page
->
pos
));
DBUG_PRINT
(
"page"
,(
"write page at: %lu"
,(
ulong
)
(
page
->
pos
/
block_size
)
));
DBUG_DUMP
(
"buff"
,
buff
,
page_length
);
DBUG_ASSERT
(
page_length
>=
share
->
keypage_header
+
nod_flag
+
page
->
keyinfo
->
minlength
||
maria_in_recovery
);
...
...
@@ -274,7 +283,7 @@ int _ma_dispose(register MARIA_HA *info, my_off_t pos, my_bool page_not_read)
enum
pagecache_page_lock
lock_method
;
enum
pagecache_page_pin
pin_method
;
DBUG_ENTER
(
"_ma_dispose"
);
DBUG_PRINT
(
"enter"
,(
"p
os: %ld"
,
(
long
)
pos
));
DBUG_PRINT
(
"enter"
,(
"p
age: %lu"
,
(
ulong
)
(
pos
/
block_size
)
));
DBUG_ASSERT
(
pos
%
block_size
==
0
);
(
void
)
_ma_lock_key_del
(
info
,
0
);
...
...
@@ -452,32 +461,48 @@ my_off_t _ma_new(register MARIA_HA *info, int level,
Log compactation of a index page
*/
static
my_bool
_ma_log_compact_keypage
(
MARIA_
HA
*
info
,
my_off_t
page
,
static
my_bool
_ma_log_compact_keypage
(
MARIA_
PAGE
*
ma_
page
,
TrID
min_read_from
)
{
LSN
lsn
;
uchar
log_data
[
FILEID_STORE_SIZE
+
PAGE_STORE_SIZE
+
1
+
TRANSID_SIZE
];
uchar
log_data
[
FILEID_STORE_SIZE
+
PAGE_STORE_SIZE
+
1
+
7
+
TRANSID_SIZE
];
uchar
*
log_pos
;
LEX_CUSTRING
log_array
[
TRANSLOG_INTERNAL_PARTS
+
1
];
MARIA_HA
*
info
=
ma_page
->
info
;
MARIA_SHARE
*
share
=
info
->
s
;
uint
translog_parts
,
extra_length
;
my_off_t
page
=
ma_page
->
pos
;
DBUG_ENTER
(
"_ma_log_compact_keypage"
);
DBUG_PRINT
(
"enter"
,
(
"page: %lu"
,
(
ulong
)
page
));
DBUG_PRINT
(
"enter"
,
(
"page: %lu"
,
(
ulong
)
(
page
/
share
->
block_size
)
));
/* Store address of new root page */
page
/=
share
->
block_size
;
page_store
(
log_data
+
FILEID_STORE_SIZE
,
page
);
log_data
[
FILEID_STORE_SIZE
+
PAGE_STORE_SIZE
]
=
KEY_OP_COMPACT_PAGE
;
transid_store
(
log_data
+
FILEID_STORE_SIZE
+
PAGE_STORE_SIZE
+
1
,
min_read_from
);
log_pos
=
log_data
+
FILEID_STORE_SIZE
+
PAGE_STORE_SIZE
;
log_pos
[
0
]
=
KEY_OP_COMPACT_PAGE
;
transid_store
(
log_pos
+
1
,
min_read_from
);
log_pos
+=
1
+
TRANSID_SIZE
;
log_array
[
TRANSLOG_INTERNAL_PARTS
+
0
].
str
=
log_data
;
log_array
[
TRANSLOG_INTERNAL_PARTS
+
0
].
length
=
sizeof
(
log_data
);
log_array
[
TRANSLOG_INTERNAL_PARTS
+
0
].
length
=
(
uint
)
(
log_pos
-
log_data
);
translog_parts
=
1
;
extra_length
=
0
;
_ma_log_key_changes
(
ma_page
,
log_array
+
TRANSLOG_INTERNAL_PARTS
+
translog_parts
,
log_pos
,
&
extra_length
,
&
translog_parts
);
/* Remember new page length for future log entires for same page */
ma_page
->
org_size
=
ma_page
->
size
;
if
(
translog_write_record
(
&
lsn
,
LOGREC_REDO_INDEX
,
info
->
trn
,
info
,
(
translog_size_t
)
sizeof
(
log_data
),
TRANSLOG_INTERNAL_PARTS
+
1
,
log_array
,
log_data
,
NULL
))
log_array
[
TRANSLOG_INTERNAL_PARTS
+
0
].
length
+
extra_length
,
TRANSLOG_INTERNAL_PARTS
+
translog_parts
,
log_array
,
log_data
,
NULL
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
0
);
}
...
...
@@ -525,7 +550,7 @@ my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from)
{
if
(
!
(
page
=
(
*
ma_page
->
keyinfo
->
skip_key
)(
&
key
,
0
,
0
,
page
)))
{
DBUG_PRINT
(
"error"
,(
"Couldn't find last key: page: 0x%lx"
,
DBUG_PRINT
(
"error"
,(
"Couldn't find last key: page
_pos
: 0x%lx"
,
(
long
)
page
));
maria_print_error
(
share
,
HA_ERR_CRASHED
);
my_errno
=
HA_ERR_CRASHED
;
...
...
@@ -587,7 +612,7 @@ my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from)
if
(
share
->
now_transactional
)
{
if
(
_ma_log_compact_keypage
(
info
,
ma_page
->
pos
,
min_read_from
))
if
(
_ma_log_compact_keypage
(
ma_page
,
min_read_from
))
DBUG_RETURN
(
1
);
}
DBUG_RETURN
(
0
);
...
...
storage/maria/ma_recovery.c
View file @
172356b0
...
...
@@ -1063,6 +1063,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
param
.
isam_file_name
=
name
=
info
->
s
->
open_file_name
.
str
;
param
.
testflag
=
uint8korr
(
rec
->
header
+
FILEID_STORE_SIZE
);
param
.
tmpdir
=
maria_tmpdir
;
param
.
max_trid
=
max_long_trid
;
DBUG_ASSERT
(
maria_tmpdir
);
info
->
s
->
state
.
key_map
=
uint8korr
(
rec
->
header
+
FILEID_STORE_SIZE
+
8
);
...
...
storage/maria/ma_rt_key.c
View file @
172356b0
...
...
@@ -91,7 +91,8 @@ int maria_rtree_delete_key(MARIA_PAGE *page, uchar *key, uint key_length)
page
->
size
-=
key_length_with_nod_flag
;
page_store_size
(
share
,
page
);
if
(
share
->
now_transactional
&&
_ma_log_delete
(
page
,
key_start
,
0
,
key_length_with_nod_flag
))
_ma_log_delete
(
page
,
key_start
,
0
,
key_length_with_nod_flag
,
0
,
KEY_OP_DEBUG_LOG_DEL_CHANGE_RT
))
return
-
1
;
return
0
;
}
...
...
storage/maria/ma_rt_split.c
View file @
172356b0
...
...
@@ -308,7 +308,7 @@ static my_bool _ma_log_rt_split(MARIA_PAGE *page,
LSN
lsn
;
uchar
log_data
[
FILEID_STORE_SIZE
+
PAGE_STORE_SIZE
+
1
+
2
+
1
+
2
+
2
+
7
],
*
log_pos
;
LEX_CUSTRING
log_array
[
TRANSLOG_INTERNAL_PARTS
+
5
];
LEX_CUSTRING
log_array
[
TRANSLOG_INTERNAL_PARTS
+
6
];
uint
translog_parts
,
extra_length
=
0
;
my_off_t
page_pos
;
DBUG_ENTER
(
"_ma_log_rt_split"
);
...
...
@@ -344,24 +344,11 @@ static my_bool _ma_log_rt_split(MARIA_PAGE *page,
translog_parts
+=
2
;
}
#ifdef EXTRA_DEBUG_KEY_CHANGES
{
int
page_length
=
page
->
size
;
ha_checksum
crc
;
uchar
*
check_start
=
log_pos
;
crc
=
my_checksum
(
0
,
page
->
buff
+
LSN_STORE_SIZE
,
page_length
-
LSN_STORE_SIZE
);
log_pos
[
0
]
=
KEY_OP_CHECK
;
log_pos
++
;
int2store
(
log_pos
,
page_length
);
log_pos
+=
2
;
int4store
(
log_pos
,
crc
);
log_pos
+=
4
;
log_array
[
TRANSLOG_INTERNAL_PARTS
+
translog_parts
].
str
=
check_start
;
log_array
[
TRANSLOG_INTERNAL_PARTS
+
translog_parts
].
length
=
7
;
translog_parts
++
;
}
#endif
_ma_log_key_changes
(
page
,
log_array
+
TRANSLOG_INTERNAL_PARTS
+
translog_parts
,
log_pos
,
&
extra_length
,
&
translog_parts
);
/* Remember new page length for future log entires for same page */
page
->
org_size
=
page
->
size
;
if
(
translog_write_record
(
&
lsn
,
LOGREC_REDO_INDEX
,
info
->
trn
,
info
,
...
...
storage/maria/ma_write.c
View file @
172356b0
This diff is collapsed.
Click to expand it.
storage/maria/maria_def.h
View file @
172356b0
...
...
@@ -39,6 +39,7 @@
#define SANITY_CHECKS 1
#ifdef EXTRA_DEBUG
#define EXTRA_DEBUG_KEY_CHANGES
#define EXTRA_STORE_FULL_PAGE_IN_KEY_CHANGES
#endif
#define MAX_NONMAPPED_INSERTS 1000
...
...
@@ -361,6 +362,7 @@ typedef struct st_maria_share
uint
in_trans
;
/* Number of references by trn */
uint
w_locks
,
r_locks
,
tot_locks
;
/* Number of read/write locks */
uint
block_size
;
/* block_size of keyfile & data file*/
uint
max_index_block_size
;
/* block_size - end_of_page_info */
/* Fixed length part of a packed row in BLOCK_RECORD format */
uint
base_length
;
myf
write_flag
;
...
...
@@ -833,6 +835,7 @@ typedef struct st_maria_page
uchar
*
buff
;
/* Data for page */
my_off_t
pos
;
/* Disk address to page */
uint
size
;
/* Size of data on page */
uint
org_size
;
/* Size of page at read or after log */
uint
node
;
/* 0 or share->base.key_reflength */
uint
flag
;
/* Page flag */
uint
link_offset
;
...
...
storage/maria/trnman.c
View file @
172356b0
...
...
@@ -363,6 +363,7 @@ TRN *trnman_new_trn(WT_THD *wt)
trn
->
used_tables
=
0
;
trn
->
locked_tables
=
0
;
trn
->
flags
=
0
;
/*
only after the following function TRN is considered initialized,
...
...
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