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
3c44bca6
Commit
3c44bca6
authored
Jan 07, 2008
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto-zerofill when a table is moved from another server
parent
cab8a363
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
5 deletions
+57
-5
storage/maria/ha_maria.cc
storage/maria/ha_maria.cc
+38
-2
storage/maria/ha_maria.h
storage/maria/ha_maria.h
+2
-2
storage/maria/ma_check.c
storage/maria/ma_check.c
+2
-1
storage/maria/ma_open.c
storage/maria/ma_open.c
+14
-0
storage/maria/maria_def.h
storage/maria/maria_def.h
+1
-0
No files found.
storage/maria/ha_maria.cc
View file @
3c44bca6
...
@@ -1181,6 +1181,24 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
...
@@ -1181,6 +1181,24 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt)
return
error
;
return
error
;
}
}
int
ha_maria
::
zerofill
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
int
error
;
HA_CHECK
param
;
if
(
!
file
)
return
HA_ADMIN_INTERNAL_ERROR
;
maria_chk_init
(
&
param
);
param
.
thd
=
thd
;
param
.
op_name
=
"zerofill"
;
param
.
testflag
=
check_opt
->
flags
|
T_SILENT
|
T_ZEROFILL
;
param
.
sort_buffer_length
=
check_opt
->
sort_buffer_size
;
error
=
maria_zerofill
(
&
param
,
file
,
file
->
s
->
open_file_name
);
return
error
;
}
int
ha_maria
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
int
ha_maria
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
{
int
error
;
int
error
;
...
@@ -1740,7 +1758,7 @@ int ha_maria::end_bulk_insert()
...
@@ -1740,7 +1758,7 @@ int ha_maria::end_bulk_insert()
bool
ha_maria
::
check_and_repair
(
THD
*
thd
)
bool
ha_maria
::
check_and_repair
(
THD
*
thd
)
{
{
int
error
=
0
;
int
error
;
int
marked_crashed
;
int
marked_crashed
;
char
*
old_query
;
char
*
old_query
;
uint
old_query_length
;
uint
old_query_length
;
...
@@ -1748,6 +1766,24 @@ bool ha_maria::check_and_repair(THD *thd)
...
@@ -1748,6 +1766,24 @@ bool ha_maria::check_and_repair(THD *thd)
DBUG_ENTER
(
"ha_maria::check_and_repair"
);
DBUG_ENTER
(
"ha_maria::check_and_repair"
);
check_opt
.
init
();
check_opt
.
init
();
if
(
file
->
s
->
state
.
changed
&
STATE_MOVED
)
{
sql_print_information
(
"Zerofilling 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.
but don't auto-repair if maria_recover_options is not set
*/
if
(
!
maria_recover_options
)
DBUG_RETURN
(
error
);
error
=
0
;
check_opt
.
flags
=
T_MEDIUM
|
T_AUTO_REPAIR
;
check_opt
.
flags
=
T_MEDIUM
|
T_AUTO_REPAIR
;
// Don't use quick if deleted rows
// Don't use quick if deleted rows
if
(
!
file
->
state
->
del
&&
(
maria_recover_options
&
HA_RECOVER_QUICK
))
if
(
!
file
->
state
->
del
&&
(
maria_recover_options
&
HA_RECOVER_QUICK
))
...
@@ -1782,7 +1818,7 @@ bool ha_maria::check_and_repair(THD *thd)
...
@@ -1782,7 +1818,7 @@ bool ha_maria::check_and_repair(THD *thd)
bool
ha_maria
::
is_crashed
()
const
bool
ha_maria
::
is_crashed
()
const
{
{
return
(
file
->
s
->
state
.
changed
&
STATE_CRASHED
||
return
(
file
->
s
->
state
.
changed
&
(
STATE_CRASHED
|
STATE_MOVED
)
||
(
my_disable_locking
&&
file
->
s
->
state
.
open_count
));
(
my_disable_locking
&&
file
->
s
->
state
.
open_count
));
}
}
...
...
storage/maria/ha_maria.h
View file @
3c44bca6
...
@@ -41,6 +41,7 @@ class ha_maria :public handler
...
@@ -41,6 +41,7 @@ class ha_maria :public handler
enum
data_file_type
data_file_type
;
enum
data_file_type
data_file_type
;
bool
can_enable_indexes
;
bool
can_enable_indexes
;
int
repair
(
THD
*
thd
,
HA_CHECK
&
param
,
bool
optimize
);
int
repair
(
THD
*
thd
,
HA_CHECK
&
param
,
bool
optimize
);
int
zerofill
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
public:
public:
ha_maria
(
handlerton
*
hton
,
TABLE_SHARE
*
table_arg
);
ha_maria
(
handlerton
*
hton
,
TABLE_SHARE
*
table_arg
);
...
@@ -133,8 +134,7 @@ public:
...
@@ -133,8 +134,7 @@ public:
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
repair
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
bool
check_and_repair
(
THD
*
thd
);
bool
check_and_repair
(
THD
*
thd
);
bool
is_crashed
()
const
;
bool
is_crashed
()
const
;
bool
auto_repair
()
const
bool
auto_repair
()
const
{
return
1
;
}
{
return
maria_recover_options
!=
0
;
}
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
restore
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
restore
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
backup
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
int
backup
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
);
...
...
storage/maria/ma_check.c
View file @
3c44bca6
...
@@ -3061,7 +3061,8 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name)
...
@@ -3061,7 +3061,8 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name)
Mark that table is movable and that we have done zerofill of data and
Mark that table is movable and that we have done zerofill of data and
index
index
*/
*/
info
->
s
->
state
.
changed
&=
~
(
STATE_NOT_ZEROFILLED
|
STATE_NOT_MOVABLE
);
info
->
s
->
state
.
changed
&=
~
(
STATE_NOT_ZEROFILLED
|
STATE_NOT_MOVABLE
|
STATE_MOVED
);
/* Ensure state are flushed to disk */
/* Ensure state are flushed to disk */
info
->
update
=
(
HA_STATE_CHANGED
|
HA_STATE_ROW_CHANGED
);
info
->
update
=
(
HA_STATE_CHANGED
|
HA_STATE_ROW_CHANGED
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
...
storage/maria/ma_open.c
View file @
3c44bca6
...
@@ -396,6 +396,17 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
...
@@ -396,6 +396,17 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
goto
err
;
goto
err
;
}
}
if
(
memcmp
(
share
->
base
.
uuid
,
maria_uuid
,
MY_UUID_SIZE
))
{
if
(
open_flags
&
HA_OPEN_FOR_REPAIR
)
share
->
state
.
changed
|=
STATE_MOVED
;
else
{
my_errno
=
HA_ERR_OLD_FILE
;
goto
err
;
}
}
/* sanity check */
/* sanity check */
if
(
share
->
base
.
keystart
>
65535
||
share
->
base
.
rec_reflength
>
8
)
if
(
share
->
base
.
keystart
>
65535
||
share
->
base
.
rec_reflength
>
8
)
{
{
...
@@ -796,6 +807,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
...
@@ -796,6 +807,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
if
(
!
(
m_info
=
maria_clone_internal
(
share
,
mode
,
data_file
)))
if
(
!
(
m_info
=
maria_clone_internal
(
share
,
mode
,
data_file
)))
goto
err
;
goto
err
;
pthread_mutex_unlock
(
&
THR_LOCK_maria
);
pthread_mutex_unlock
(
&
THR_LOCK_maria
);
DBUG_RETURN
(
m_info
);
DBUG_RETURN
(
m_info
);
...
@@ -805,6 +817,8 @@ err:
...
@@ -805,6 +817,8 @@ err:
(
save_errno
==
HA_ERR_CRASHED_ON_USAGE
)
||
(
save_errno
==
HA_ERR_CRASHED_ON_USAGE
)
||
(
save_errno
==
HA_ERR_CRASHED_ON_REPAIR
))
(
save_errno
==
HA_ERR_CRASHED_ON_REPAIR
))
_ma_report_error
(
save_errno
,
name
);
_ma_report_error
(
save_errno
,
name
);
if
(
save_errno
==
HA_ERR_OLD_FILE
)
/* uuid is different ? */
save_errno
=
HA_ERR_CRASHED_ON_USAGE
;
/* the code to trigger auto-repair */
switch
(
errpos
)
{
switch
(
errpos
)
{
case
5
:
case
5
:
if
(
data_file
>=
0
)
if
(
data_file
>=
0
)
...
...
storage/maria/maria_def.h
View file @
3c44bca6
...
@@ -548,6 +548,7 @@ struct st_maria_handler
...
@@ -548,6 +548,7 @@ struct st_maria_handler
#define STATE_NOT_OPTIMIZED_ROWS 64
#define STATE_NOT_OPTIMIZED_ROWS 64
#define STATE_NOT_ZEROFILLED 128
#define STATE_NOT_ZEROFILLED 128
#define STATE_NOT_MOVABLE 256
#define STATE_NOT_MOVABLE 256
#define STATE_MOVED 512
/* set if base->uuid != maria_uuid */
/* options to maria_read_cache */
/* options to maria_read_cache */
...
...
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