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
f491ab53
Commit
f491ab53
authored
Sep 12, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Pulled in the latest changes in 5.1.
parents
b3cd40e0
b9890b05
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
79 additions
and
41 deletions
+79
-41
dbug/remove_function_from_trace.pl
dbug/remove_function_from_trace.pl
+5
-6
storage/maria/ha_maria.cc
storage/maria/ha_maria.cc
+6
-4
storage/maria/ma_bitmap.c
storage/maria/ma_bitmap.c
+8
-1
storage/maria/ma_blockrec.c
storage/maria/ma_blockrec.c
+2
-2
storage/maria/ma_blockrec.h
storage/maria/ma_blockrec.h
+1
-0
storage/maria/ma_check.c
storage/maria/ma_check.c
+7
-3
storage/maria/ma_open.c
storage/maria/ma_open.c
+7
-1
storage/maria/ma_recovery.c
storage/maria/ma_recovery.c
+12
-1
storage/maria/maria_chk.c
storage/maria/maria_chk.c
+28
-22
storage/maria/maria_def.h
storage/maria/maria_def.h
+2
-1
storage/maria/trnman.c
storage/maria/trnman.c
+1
-0
No files found.
dbug/remove_function_from_trace.pl
View file @
f491ab53
#!/usr/bin/perl
die
<<
EEE
unless
@ARGV
;
Usage:
$0
func1
[
func2
[
...
]
]
...
...
@@ -11,16 +10,16 @@ DBUG_ENTER() and DBUG_POP(); right before DBUG_RETURN in every such a function.
EEE
$re
=
join
('
|
',
@ARGV
);
$skip
=
'';
while
(
<
STDIN
>
)
{
print
unless
$skip
;
(
$thd
)
=
/^(T@\d+)/
;
print
unless
$skip
{
$thd
};
next
unless
/^(?:.*: )*((?:\| )*)([<>])($re)\n/o
;
if
(
$2
eq
'
>
')
{
$skip
=
$1
.
$3
unless
$skip
;
$skip
{
$thd
}
=
$1
.
$3
unless
$skip
{
$thd
}
;
next
;
}
next
if
$skip
ne
$1
.
$3
;
$skip
=
''
;
next
if
$skip
{
$thd
}
ne
$1
.
$3
;
delete
$skip
{
$thd
}
;
print
;
}
storage/maria/ha_maria.cc
View file @
f491ab53
...
...
@@ -2006,14 +2006,16 @@ bool ha_maria::check_and_repair(THD *thd)
check_opt
.
init
();
if
(
file
->
s
->
state
.
changed
&
STATE_MOVED
)
error
=
1
;
if
((
file
->
s
->
state
.
changed
&
(
STATE_CRASHED
|
STATE_CRASHED_ON_REPAIR
|
STATE_MOVED
))
==
STATE_MOVED
)
{
sql_print_information
(
"Zerofilling table: '%s'"
,
table
->
s
->
path
.
str
);
sql_print_information
(
"Zerofilling moved table: '%s'"
,
table
->
s
->
path
.
str
);
if
(
!
(
error
=
zerofill
(
thd
,
&
check_opt
)))
DBUG_RETURN
(
0
);
}
else
error
=
1
;
/*
if we got this far - the table is crashed.
...
...
storage/maria/ma_bitmap.c
View file @
f491ab53
...
...
@@ -147,6 +147,12 @@ static inline my_bool write_changed_bitmap(MARIA_SHARE *share,
DBUG_ASSERT
(
bitmap
->
file
.
write_callback
!=
0
);
DBUG_PRINT
(
"info"
,
(
"bitmap->non_flushable: %u"
,
bitmap
->
non_flushable
));
/*
Mark that a bitmap page has been written to page cache and we have
to flush it during checkpoint.
*/
bitmap
->
changed_not_flushed
=
1
;
if
((
bitmap
->
non_flushable
==
0
)
#ifdef WRONG_BITMAP_FLUSH
||
1
...
...
@@ -347,7 +353,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
MARIA_FILE_BITMAP
*
bitmap
=
&
share
->
bitmap
;
DBUG_ENTER
(
"_ma_bitmap_flush_all"
);
pthread_mutex_lock
(
&
bitmap
->
bitmap_lock
);
if
(
bitmap
->
changed
)
if
(
bitmap
->
changed
||
bitmap
->
changed_not_flushed
)
{
bitmap
->
flush_all_requested
=
TRUE
;
#ifndef WRONG_BITMAP_FLUSH
...
...
@@ -384,6 +390,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
&
bitmap
->
pages_covered
)
&
PCFLUSH_PINNED_AND_ERROR
)
res
=
TRUE
;
bitmap
->
changed_not_flushed
=
FALSE
;
bitmap
->
flush_all_requested
=
FALSE
;
/*
Some well-behaved threads may be waiting for flush_all_requested to
...
...
storage/maria/ma_blockrec.c
View file @
f491ab53
...
...
@@ -742,8 +742,8 @@ static my_bool enough_free_entries(uchar *buff, uint block_size,
@return 1 There is room for more entries on the page
*/
static
my_bool
enough_free_entries_on_page
(
MARIA_SHARE
*
share
,
uchar
*
page_buff
)
my_bool
enough_free_entries_on_page
(
MARIA_SHARE
*
share
,
uchar
*
page_buff
)
{
enum
en_page_type
page_type
;
page_type
=
(
enum
en_page_type
)
(
page_buff
[
PAGE_TYPE_OFFSET
]
&
...
...
storage/maria/ma_blockrec.h
View file @
f491ab53
...
...
@@ -176,6 +176,7 @@ my_bool _ma_compare_block_record(register MARIA_HA *info,
void
_ma_compact_block_page
(
uchar
*
buff
,
uint
block_size
,
uint
rownr
,
my_bool
extend_block
,
TrID
min_read_from
,
uint
min_row_length
);
my_bool
enough_free_entries_on_page
(
MARIA_SHARE
*
share
,
uchar
*
page_buff
);
TRANSLOG_ADDRESS
maria_page_get_lsn
(
uchar
*
page
,
pgcache_page_no_t
page_no
,
uchar
*
data_ptr
);
...
...
storage/maria/ma_check.c
View file @
f491ab53
...
...
@@ -1760,7 +1760,7 @@ static my_bool check_head_page(HA_CHECK *param, MARIA_HA *info, uchar *record,
_ma_check_print_error
(
param
,
"Page %9s: Row: %3d has an extent with "
"wrong information in bitmap: "
"Page %9s Page_type: %d Bitmap: %d"
,
"Page
:
%9s Page_type: %d Bitmap: %d"
,
llstr
(
page
,
llbuff
),
row
,
llstr
(
extent_page
,
llbuff2
),
page_type
,
bitmap_pattern
);
...
...
@@ -3376,7 +3376,7 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info,
case
TAIL_PAGE
:
{
uint
max_entry
=
(
uint
)
buff
[
DIR_COUNT_OFFSET
];
uint
offset
,
dir_start
;
uint
offset
,
dir_start
,
empty_space
;
uchar
*
dir
;
if
(
zero_lsn
)
...
...
@@ -3389,9 +3389,13 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info,
is_head_page
?
~
(
TrID
)
0
:
0
,
is_head_page
?
share
->
base
.
min_block_length
:
0
);
/* compactation may have increased free space */
empty_space
=
uint2korr
(
buff
+
EMPTY_SPACE_OFFSET
);
if
(
!
enough_free_entries_on_page
(
share
,
buff
))
empty_space
=
0
;
/* Page is full */
if
(
_ma_bitmap_set
(
info
,
page
,
is_head_page
,
uint2korr
(
buff
+
EMPTY_SPACE_OFFSET
)
))
empty_space
))
goto
err
;
/* Zerofill the not used part */
...
...
storage/maria/ma_open.c
View file @
f491ab53
...
...
@@ -434,8 +434,14 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share
->
base
.
born_transactional
&&
((
!
(
open_flags
&
HA_OPEN_IGNORE_MOVED_STATE
)
&&
memcmp
(
share
->
base
.
uuid
,
maria_uuid
,
MY_UUID_SIZE
))
||
share
->
state
.
create_trid
>
trnman_get_max_trid
()))
(
share
->
state
.
create_trid
>
trnman_get_max_trid
()
&&
!
maria_in_recovery
)))
{
DBUG_PRINT
(
"warning"
,
(
"table is moved from another system. uuid_diff: %d create_trid: %lu max_trid: %lu"
,
memcmp
(
share
->
base
.
uuid
,
maria_uuid
,
MY_UUID_SIZE
)
!=
0
,
(
ulong
)
share
->
state
.
create_trid
,
(
ulong
)
trnman_get_max_trid
()));
if
(
open_flags
&
HA_OPEN_FOR_REPAIR
)
share
->
state
.
changed
|=
STATE_MOVED
;
else
...
...
storage/maria/ma_recovery.c
View file @
f491ab53
...
...
@@ -332,6 +332,8 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
if
(
end_lsn
!=
LSN_IMPOSSIBLE
)
{
abort_message_printed
=
1
;
if
(
!
trace_file
)
fputc
(
'\n'
,
stderr
);
my_message
(
HA_ERR_INITIALIZATION
,
"Maria recovery aborted as end_lsn/end of file was reached"
,
MYF
(
0
));
...
...
@@ -502,9 +504,13 @@ end:
}
if
(
error
&&
!
abort_message_printed
)
{
if
(
!
trace_file
)
fputc
(
'\n'
,
stderr
);
my_message
(
HA_ERR_INITIALIZATION
,
"Maria recovery failed. Please run maria_chk -r on all maria "
"tables and delete all maria_log.######## files"
,
MYF
(
0
));
}
procent_printed
=
0
;
/*
We don't cleanly close tables if we hit some error (may corrupt them by
...
...
@@ -3315,7 +3321,12 @@ static int close_all_tables(void)
state while they were used. As Recovery corrected them, don't alarm the
user, don't ask for a table check:
*/
info
->
s
->
state
.
open_count
=
0
;
if
(
info
->
s
->
state
.
open_count
!=
0
)
{
/* let ma_close() mark the table properly closed */
info
->
s
->
state
.
open_count
=
1
;
info
->
s
->
global_changed
=
1
;
}
prepare_table_for_close
(
info
,
addr
);
error
|=
maria_close
(
info
);
pthread_mutex_lock
(
&
THR_LOCK_maria
);
...
...
storage/maria/maria_chk.c
View file @
f491ab53
...
...
@@ -271,10 +271,10 @@ static struct my_option my_long_options[] =
&
check_param
.
keys_in_use
,
0
,
GET_ULL
,
REQUIRED_ARG
,
-
1
,
0
,
0
,
0
,
0
,
0
},
{
"datadir"
,
OPT_DATADIR
,
"Path for control file (and logs if --log
-
dir not used)."
,
"Path for control file (and logs if --logdir not used)."
,
&
maria_data_root
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"log
-
dir"
,
OPT_LOG_DIR
,
{
"logdir"
,
OPT_LOG_DIR
,
"Path for log files."
,
(
char
**
)
&
opt_log_dir
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"max-record-length"
,
OPT_MAX_RECORD_LENGTH
,
...
...
@@ -320,9 +320,6 @@ static struct my_option my_long_options[] =
"Change the collation used by the index"
,
(
char
**
)
&
set_collation_name
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"set-variable"
,
'O'
,
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value."
,
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"silent"
,
's'
,
"Only print errors. One can use two -s to make maria_chk very silent."
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
...
@@ -353,7 +350,7 @@ static struct my_option my_long_options[] =
"properly closed'"
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"unpack"
,
'u'
,
"Unpack file packed with mariapack."
,
"Unpack file packed with maria
_
pack."
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"verbose"
,
'v'
,
"Print more information. This can be used with --description and --check. Use many -v for more verbosity!"
,
...
...
@@ -372,12 +369,14 @@ static struct my_option my_long_options[] =
&
check_param
.
use_buffers
,
&
check_param
.
use_buffers
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
(
long
)
USE_BUFFER_INIT
,
1024L
*
1024L
,
(
long
)
~
0L
,
(
long
)
MALLOC_OVERHEAD
,
(
long
)
IO_SIZE
,
0
},
{
"read_buffer_size"
,
OPT_READ_BUFFER_SIZE
,
""
,
{
"read_buffer_size"
,
OPT_READ_BUFFER_SIZE
,
"Read buffer size for sequential reads during scanning"
,
&
check_param
.
read_buffer_length
,
&
check_param
.
read_buffer_length
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
(
long
)
READ_BUFFER_INIT
,
(
long
)
MALLOC_OVERHEAD
,
(
long
)
~
0L
,
(
long
)
MALLOC_OVERHEAD
,
(
long
)
1L
,
0
},
{
"write_buffer_size"
,
OPT_WRITE_BUFFER_SIZE
,
""
,
{
"write_buffer_size"
,
OPT_WRITE_BUFFER_SIZE
,
"Write buffer size for sequential writes during repair of fixed size or dynamic size rows"
,
&
check_param
.
write_buffer_length
,
&
check_param
.
write_buffer_length
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
(
long
)
READ_BUFFER_INIT
,
(
long
)
MALLOC_OVERHEAD
,
...
...
@@ -388,7 +387,8 @@ static struct my_option my_long_options[] =
&
check_param
.
sort_buffer_length
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
(
long
)
SORT_BUFFER_INIT
,
(
long
)
(
MIN_SORT_BUFFER
+
MALLOC_OVERHEAD
),
(
long
)
~
0L
,
(
long
)
MALLOC_OVERHEAD
,
(
long
)
1L
,
0
},
{
"sort_key_blocks"
,
OPT_SORT_KEY_BLOCKS
,
""
,
{
"sort_key_blocks"
,
OPT_SORT_KEY_BLOCKS
,
"Internal buffer for sorting keys; Don't touch :)"
,
&
check_param
.
sort_key_blocks
,
&
check_param
.
sort_key_blocks
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
BUFFERS_WHEN_SORTING
,
4L
,
100L
,
0L
,
1L
,
0
},
...
...
@@ -411,7 +411,7 @@ static struct my_option my_long_options[] =
(
char
**
)
&
maria_stats_method_str
,
(
char
**
)
&
maria_stats_method_str
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"zerofill"
,
'z'
,
"Fill empty space in data and index files with zeroes"
,
"Fill empty space in data and index files with zeroes
,
"
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"zerofill-keep-lsn"
,
OPT_ZEROFILL_KEEP_LSN
,
"Like --zerofill but does not zero out LSN of data/index pages;"
...
...
@@ -447,10 +447,12 @@ static void usage(void)
printf
(
"\
-H, --HELP Display this help and exit.
\n
\
-?, --help Display this help and exit.
\n
\
-O, --set-variable var=option.
\n
\
Change the value of a variable. Please note that
\n
\
this option is deprecated; you can set variables
\n
\
directly with '--variable-name=value'.
\n
\
--datadir=path Path for control file (and logs if --logdir not used)
\n
\
--logdir=path Path for log files
\n
\
--require-control-file Abort if we can't find/read the maria_log_control
\n
\
file
\n
\
-s, --silent Only print errors. One can use two -s to make
\n
\
maria_chk very silent.
\n
\
-t, --tmpdir=path Path for temporary files. Multiple paths can be
\n
\
specified, separated by "
);
#if defined( __WIN__) || defined(__NETWARE__)
...
...
@@ -458,12 +460,8 @@ static void usage(void)
#else
printf
(
"colon (:)"
);
#endif
printf
(
", they will be used
\n
\
printf
(
", they will be used
\n
\
in a round-robin fashion.
\n
\
--require-control-file Abort if we can't find/read the maria_log_control
\n
\
file
\n
\
-s, --silent Only print errors. One can use two -s to make
\n
\
maria_chk very silent.
\n
\
-v, --verbose Print more information. This can be used with
\n
\
--description and --check. Use many -v for more verbosity.
\n
\
-V, --version Print version and exit.
\n
\
...
...
@@ -485,10 +483,11 @@ static void usage(void)
-i, --information Print statistics information about table that is checked.
\n
\
-m, --medium-check Faster than extend-check, but only finds 99.99% of
\n
\
all errors. Should be good enough for most cases.
\n
\
-U
--update-state Mark tables as crashed if you find any errors.
\n
\
-U
,
--update-state Mark tables as crashed if you find any errors.
\n
\
-T, --read-only Don't mark table as checked.
\n
"
);
puts
(
"Recover (repair)/ options (When using '-r' or '-o'):
\n
\
puts
(
"\
Recover (repair)/ options (When using '--recover' or '--safe-recover'):
\n
\
-B, --backup Make a backup of the .MAD file as 'filename-time.BAK'.
\n
\
--correct-checksum Correct checksum information for table.
\n
\
-D, --data-file-length=# Max length of data file (when recreating data
\n
\
...
...
@@ -531,7 +530,7 @@ static void usage(void)
puts
(
"Other actions:
\n
\
-a, --analyze Analyze distribution of keys. Will make some joins in
\n
\
M
ySQL
faster. You can check the calculated distribution
\n
\
M
ariaDB
faster. You can check the calculated distribution
\n
\
by using '--description --verbose table_name'.
\n
\
--stats_method=name Specifies how index statistics collection code should
\n
\
treat NULLs. Possible values of name are
\"
nulls_unequal
\"\n
\
...
...
@@ -554,6 +553,13 @@ static void usage(void)
--zerofill-keep-lsn Like --zerofill but does not zero out LSN of
\n
\
data/index pages."
);
puts
(
"Variables:
\n
\
--page_buffer_size=# Size of page buffer. Used by --safe-repair
\n
\
--read_buffer_size=# Read buffer size for sequential reads during scanning
\n
\
--sort_buffer_size=# Size of sort buffer. Used by --recover
\n
\
--sort_key_blocks=# Internal buffer for sorting keys; Don't touch :)
\n
\
--write_buffer_size=# Write buffer size for sequential writes during repair"
);
print_defaults
(
"my"
,
load_default_groups
);
my_print_variables
(
my_long_options
);
}
...
...
storage/maria/maria_def.h
View file @
f491ab53
...
...
@@ -244,7 +244,8 @@ typedef struct st_maria_file_bitmap
uchar
*
map
;
pgcache_page_no_t
page
;
/* Page number for current bitmap */
uint
used_size
;
/* Size of bitmap head that is not 0 */
my_bool
changed
;
/* 1 if page needs to be flushed */
my_bool
changed
;
/* 1 if page needs to be written */
my_bool
changed_not_flushed
;
/* 1 if some bitmap is not flushed */
my_bool
flush_all_requested
;
/**< If _ma_bitmap_flush_all waiting */
uint
non_flushable
;
/**< 0 if bitmap and log are in sync */
PAGECACHE_FILE
file
;
/* datafile where bitmap is stored */
...
...
storage/maria/trnman.c
View file @
f491ab53
...
...
@@ -145,6 +145,7 @@ static uchar *trn_get_hash_key(const uchar *trn, size_t *len,
int
trnman_init
(
TrID
initial_trid
)
{
DBUG_ENTER
(
"trnman_init"
);
DBUG_PRINT
(
"enter"
,
(
"initial_trid: %lu"
,
(
ulong
)
initial_trid
));
short_trid_to_active_trn
=
(
TRN
**
)
my_malloc
(
SHORT_TRID_MAX
*
sizeof
(
TRN
*
),
MYF
(
MY_WME
|
MY_ZEROFILL
));
...
...
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