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
2ace7dc9
Commit
2ace7dc9
authored
Aug 11, 2008
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge into an updated 5.1-bugteam tree
parents
1c108906
ce30b928
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
158 additions
and
4 deletions
+158
-4
mysql-test/lib/mtr_report.pl
mysql-test/lib/mtr_report.pl
+4
-1
mysql-test/std_data/corrupt_t1#P#p1.MYI
mysql-test/std_data/corrupt_t1#P#p1.MYI
+0
-0
mysql-test/std_data/corrupt_t1.MYI
mysql-test/std_data/corrupt_t1.MYI
+0
-0
mysql-test/suite/parts/r/partition_repair_myisam.result
mysql-test/suite/parts/r/partition_repair_myisam.result
+56
-0
mysql-test/suite/parts/t/partition_repair_myisam-master.opt
mysql-test/suite/parts/t/partition_repair_myisam-master.opt
+1
-0
mysql-test/suite/parts/t/partition_repair_myisam.test
mysql-test/suite/parts/t/partition_repair_myisam.test
+30
-0
sql/ha_partition.cc
sql/ha_partition.cc
+64
-0
sql/ha_partition.h
sql/ha_partition.h
+3
-3
No files found.
mysql-test/lib/mtr_report.pl
View file @
2ace7dc9
...
...
@@ -402,7 +402,10 @@ sub mtr_report_stats ($) {
))
or
# Test case for Bug#31590 produces the following error:
/Out of sort memory; increase server sort buffer size/
/Out of sort memory; increase server sort buffer size/
or
# Bug#35161, test of auto repair --myisam-recover
/able.*_will_crash/
)
{
next
;
# Skip these lines
...
...
mysql-test/std_data/corrupt_t1#P#p1.MYI
0 → 100644
View file @
2ace7dc9
File added
mysql-test/std_data/corrupt_t1.MYI
0 → 100644
View file @
2ace7dc9
File added
mysql-test/suite/parts/r/partition_repair_myisam.result
0 → 100644
View file @
2ace7dc9
CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
# replacing t1.MYI with a corrupt + unclosed one created by doing:
# 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
SELECT * FROM t1_will_crash;
a
1
2
3
4
5
6
7
8
9
10
11
Warnings:
Error 145 Table './test/t1_will_crash' is marked as crashed and should be repaired
Error 1194 Table 't1_will_crash' is marked as crashed and should be repaired
Error 1034 1 client is using or hasn't closed the table properly
Error 1034 Size of indexfile is: 1024 Should be: 2048
Error 1034 Size of datafile is: 77 Should be: 7
Error 1034 Number of rows changed from 1 to 11
DROP TABLE t1_will_crash;
CREATE TABLE t1_will_crash (a INT, KEY (a))
ENGINE=MyISAM
PARTITION BY HASH(a)
PARTITIONS 3;
INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
FLUSH TABLES;
# replacing t1#P#p1.MYI with a corrupt + unclosed one created by doing:
# 'create table t1 (a int key(a)) partition by hash (a) partitions 3'
# head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI
SELECT * FROM t1_will_crash;
a
1
2
3
4
5
6
7
8
9
10
11
Warnings:
Error 145 Table './test/t1_will_crash#P#p1' is marked as crashed and should be repaired
Error 1194 Table 't1_will_crash' is marked as crashed and should be repaired
Error 1034 1 client is using or hasn't closed the table properly
Error 1034 Size of indexfile is: 1024 Should be: 2048
Error 1034 Size of datafile is: 28 Should be: 7
Error 1034 Number of rows changed from 1 to 4
DROP TABLE t1_will_crash;
mysql-test/suite/parts/t/partition_repair_myisam-master.opt
0 → 100644
View file @
2ace7dc9
--myisam-recover
mysql-test/suite/parts/t/partition_repair_myisam.test
0 → 100644
View file @
2ace7dc9
--
source
include
/
have_partition
.
inc
--
disable_warnings
--
disable_query_log
drop
table
if
exists
t1_will_crash
;
--
enable_query_log
--
enable_warnings
CREATE
TABLE
t1_will_crash
(
a
INT
,
KEY
(
a
))
ENGINE
=
MyISAM
;
INSERT
INTO
t1_will_crash
VALUES
(
1
),
(
2
),
(
3
),
(
4
),
(
5
),
(
6
),
(
7
),
(
8
),
(
9
),
(
10
),
(
11
);
FLUSH
TABLES
;
--
echo
# replacing t1.MYI with a corrupt + unclosed one created by doing:
--
echo
# 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
--
remove_file
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
t1_will_crash
.
MYI
--
copy_file
std_data
/
corrupt_t1
.
MYI
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
t1_will_crash
.
MYI
SELECT
*
FROM
t1_will_crash
;
DROP
TABLE
t1_will_crash
;
CREATE
TABLE
t1_will_crash
(
a
INT
,
KEY
(
a
))
ENGINE
=
MyISAM
PARTITION
BY
HASH
(
a
)
PARTITIONS
3
;
INSERT
INTO
t1_will_crash
VALUES
(
1
),
(
2
),
(
3
),
(
4
),
(
5
),
(
6
),
(
7
),
(
8
),
(
9
),
(
10
),
(
11
);
FLUSH
TABLES
;
--
echo
# replacing t1#P#p1.MYI with a corrupt + unclosed one created by doing:
--
echo
# 'create table t1 (a int key(a)) partition by hash (a) partitions 3'
--
echo
# head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI
--
remove_file
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
t1_will_crash
#P#p1.MYI
--
copy_file
std_data
/
corrupt_t1
#P#p1.MYI $MYSQLTEST_VARDIR/master-data/test/t1_will_crash#P#p1.MYI
SELECT
*
FROM
t1_will_crash
;
DROP
TABLE
t1_will_crash
;
sql/ha_partition.cc
View file @
2ace7dc9
...
...
@@ -1129,6 +1129,70 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
#endif
}
/**
@brief Check and repair the table if neccesary
@param thd Thread object
@retval TRUE Error/Not supported
@retval FALSE Success
*/
bool
ha_partition
::
check_and_repair
(
THD
*
thd
)
{
handler
**
file
=
m_file
;
DBUG_ENTER
(
"ha_partition::check_and_repair"
);
do
{
if
((
*
file
)
->
ha_check_and_repair
(
thd
))
DBUG_RETURN
(
TRUE
);
}
while
(
*
(
++
file
));
DBUG_RETURN
(
FALSE
);
}
/**
@breif Check if the table can be automatically repaired
@retval TRUE Can be auto repaired
@retval FALSE Cannot be auto repaired
*/
bool
ha_partition
::
auto_repair
()
const
{
DBUG_ENTER
(
"ha_partition::auto_repair"
);
/*
As long as we only support one storage engine per table,
we can use the first partition for this function.
*/
DBUG_RETURN
(
m_file
[
0
]
->
auto_repair
());
}
/**
@breif Check if the table is crashed
@retval TRUE Crashed
@retval FALSE Not crashed
*/
bool
ha_partition
::
is_crashed
()
const
{
handler
**
file
=
m_file
;
DBUG_ENTER
(
"ha_partition::is_crashed"
);
do
{
if
((
*
file
)
->
is_crashed
())
DBUG_RETURN
(
TRUE
);
}
while
(
*
(
++
file
));
DBUG_RETURN
(
FALSE
);
}
/*
Prepare by creating a new partition
...
...
sql/ha_partition.h
View file @
2ace7dc9
...
...
@@ -936,6 +936,9 @@ public:
virtual
int
analyze_partitions
(
THD
*
thd
);
virtual
int
check_partitions
(
THD
*
thd
);
virtual
int
repair_partitions
(
THD
*
thd
);
virtual
bool
check_and_repair
(
THD
*
thd
);
virtual
bool
auto_repair
()
const
;
virtual
bool
is_crashed
()
const
;
private:
int
handle_opt_partitions
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
,
...
...
@@ -951,12 +954,9 @@ public:
virtual int restore(THD* thd, HA_CHECK_OPT *check_opt);
virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt);
virtual int preload_keys(THD *thd, HA_CHECK_OPT *check_opt);
virtual bool check_and_repair(THD *thd);
virtual int dump(THD* thd, int fd = -1);
virtual int net_read_dump(NET* net);
virtual uint checksum() const;
virtual bool is_crashed() const;
virtual bool auto_repair() const;
*/
/*
...
...
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