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
2ea52a40
Commit
2ea52a40
authored
Jan 29, 2014
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#172 map ydb errors to handler errors in prelocking functions
parent
5dd3f216
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
497886 additions
and
23 deletions
+497886
-23
mysql-test/std_data/leak172_t1.data
mysql-test/std_data/leak172_t1.data
+2
-0
mysql-test/std_data/leak172_t2.data
mysql-test/std_data/leak172_t2.data
+497584
-0
mysql-test/suite/tokudb.bugs/r/leak172.result
mysql-test/suite/tokudb.bugs/r/leak172.result
+123
-0
mysql-test/suite/tokudb.bugs/t/leak172.test
mysql-test/suite/tokudb.bugs/t/leak172.test
+146
-0
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+19
-13
storage/tokudb/ha_tokudb.h
storage/tokudb/ha_tokudb.h
+3
-0
storage/tokudb/ha_tokudb_admin.cc
storage/tokudb/ha_tokudb_admin.cc
+9
-10
No files found.
mysql-test/std_data/leak172_t1.data
0 → 100644
View file @
2ea52a40
\N,\N,\N,\N,-1,\N,\N,,0,\N,,\N,\N,\N,,\N,2004-11-01 01:02:04.031903,\N,\N,0000-00-00,\N,\N,0000-00-00,\N,\N,\N,\N,,0,\N,\N,0,\N,0000-00-00,1,0,\N
\N,\N,\N,\N,,\N,\N,,0,\N,,\N,\N,\N,,\N,,\N,\N,0000-00-00,\N,\N,0000-00-00,\N,\N,\N,\N,,0,\N,9,0,\N,0000-00-00,2,0,\N
mysql-test/std_data/leak172_t2.data
0 → 100644
View file @
2ea52a40
This diff is collapsed.
Click to expand it.
mysql-test/suite/tokudb.bugs/r/leak172.result
0 → 100644
View file @
2ea52a40
set default_storage_engine=tokudb;
drop table if exists t1,t2;
CREATE TABLE `t1` (
`c4` int(11) DEFAULT NULL,
`c5` int(11) DEFAULT NULL,
`c26` text,
`c18` blob,
`c29` text NOT NULL,
`c3` int(10) unsigned DEFAULT NULL,
`c25` text,
`c17` varchar(240) NOT NULL,
`c11` int(10) unsigned NOT NULL,
`c0` int(11) DEFAULT NULL,
`c22` blob NOT NULL,
`c13` varchar(240),
`c19` blob,
`c20` blob,
`c23` blob NOT NULL,
`c27` text,
`c28` text NOT NULL,
`c2` int(10) unsigned DEFAULT NULL,
`c12` varchar(240) DEFAULT NULL,
`c34` date NOT NULL,
`c30` date DEFAULT NULL,
`c31` date DEFAULT NULL,
`c24` date NOT NULL DEFAULT '0000-00-00',
`c33` date DEFAULT NULL,
`c21` blob,
`c1` int(11),
`c15` varchar(240) DEFAULT NULL,
`c16` varchar(240) NOT NULL,
`c9` int(11) NOT NULL,
`c32` date DEFAULT NULL,
`c7` int(10) unsigned DEFAULT NULL,
`c8` int(11) NOT NULL,
`c14` varchar(240) DEFAULT NULL,
`c35` date NOT NULL,
`pk` int(11) NOT NULL AUTO_INCREMENT,
`c10` int(10) unsigned NOT NULL,
`c6` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`pk`),
KEY `c5` (`c5`),
KEY `c29` (`c29`(255)),
KEY `c3` (`c3`),
KEY `c25` (`c25`(255)),
KEY `c17` (`c17`),
KEY `c11` (`c11`),
KEY `c13` (`c13`),
KEY `c19` (`c19`(255)),
KEY `c23` (`c23`(255)),
KEY `c27` (`c27`(255)),
KEY `c31` (`c31`),
KEY `c33` (`c33`),
KEY `c21` (`c21`(255)),
KEY `c1` (`c1`),
KEY `c15` (`c15`),
KEY `c9` (`c9`),
KEY `c7` (`c7`),
KEY `c35` (`c35`)
);
CREATE TABLE `t2` (
`c12` varchar(240) DEFAULT NULL,
`c15` varchar(240) DEFAULT NULL,
`c19` blob,
`c14` varchar(240) DEFAULT NULL,
`c6` int(10) unsigned DEFAULT NULL,
`c11` int(10) unsigned NOT NULL,
`c30` date DEFAULT NULL,
`c29` text NOT NULL,
`c20` blob,
`c18` blob,
`c23` blob NOT NULL,
`c16` varchar(240) NOT NULL,
`c10` int(10) unsigned NOT NULL,
`c25` text,
`c21` blob,
`c7` int(10) unsigned DEFAULT NULL,
`c9` int(11) NOT NULL,
`c5` int(11) DEFAULT NULL,
`c35` date NOT NULL,
`c24` text,
`c17` varchar(240) NOT NULL,
`c28` text NOT NULL,
`c33` date DEFAULT NULL,
`c26` text,
`c0` int(11) DEFAULT NULL,
`c13` varchar(240) DEFAULT NULL,
`c3` int(10) unsigned DEFAULT NULL,
`c1` int(11) DEFAULT NULL,
`pk` int(11) NOT NULL AUTO_INCREMENT,
`c34` date NOT NULL,
`c2` int(10) unsigned DEFAULT NULL,
`c4` int(11) DEFAULT NULL,
`c32` date,
`c27` text,
`c8` int(11) NOT NULL,
`c31` date DEFAULT NULL,
`c22` blob NOT NULL,
PRIMARY KEY (`pk`),
KEY `c15` (`c15`),
KEY `c19` (`c19`(255)),
KEY `c11` (`c11`),
KEY `c29` (`c29`(255)),
KEY `c23` (`c23`(255)),
KEY `c25` (`c25`(255)),
KEY `c21` (`c21`(255)),
KEY `c7` (`c7`),
KEY `c9` (`c9`),
KEY `c5` (`c5`),
KEY `c35` (`c35`),
KEY `c17` (`c17`),
KEY `c33` (`c33`),
KEY `c13` (`c13`),
KEY `c3` (`c3`),
KEY `c1` (`c1`),
KEY `c27` (`c27`(255)),
KEY `c31` (`c31`)
);
LOAD DATA INFILE 'leak172_t1.data' INTO TABLE `t1` fields terminated by ',';
LOAD DATA INFILE 'leak172_t2.data' INTO TABLE `t2`;
UPDATE t1, t2 SET t1.`c5` = 4 WHERE t1.`c6` <= 'o';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
drop table t1,t2;
mysql-test/suite/tokudb.bugs/t/leak172.test
0 → 100644
View file @
2ea52a40
source
include
/
have_tokudb
.
inc
;
set
default_storage_engine
=
tokudb
;
disable_warnings
;
drop
table
if
exists
t1
,
t2
;
enable_warnings
;
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
copy_file
std_data
/
leak172_t1
.
data
$MYSQLD_DATADIR
/
test
/
leak172_t1
.
data
;
copy_file
std_data
/
leak172_t2
.
data
$MYSQLD_DATADIR
/
test
/
leak172_t2
.
data
;
CREATE
TABLE
`t1`
(
`c4`
int
(
11
)
DEFAULT
NULL
,
`c5`
int
(
11
)
DEFAULT
NULL
,
`c26`
text
,
`c18`
blob
,
`c29`
text
NOT
NULL
,
`c3`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c25`
text
,
`c17`
varchar
(
240
)
NOT
NULL
,
`c11`
int
(
10
)
unsigned
NOT
NULL
,
`c0`
int
(
11
)
DEFAULT
NULL
,
`c22`
blob
NOT
NULL
,
`c13`
varchar
(
240
),
`c19`
blob
,
`c20`
blob
,
`c23`
blob
NOT
NULL
,
`c27`
text
,
`c28`
text
NOT
NULL
,
`c2`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c12`
varchar
(
240
)
DEFAULT
NULL
,
`c34`
date
NOT
NULL
,
`c30`
date
DEFAULT
NULL
,
`c31`
date
DEFAULT
NULL
,
`c24`
date
NOT
NULL
DEFAULT
'0000-00-00'
,
`c33`
date
DEFAULT
NULL
,
`c21`
blob
,
`c1`
int
(
11
),
`c15`
varchar
(
240
)
DEFAULT
NULL
,
`c16`
varchar
(
240
)
NOT
NULL
,
`c9`
int
(
11
)
NOT
NULL
,
`c32`
date
DEFAULT
NULL
,
`c7`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c8`
int
(
11
)
NOT
NULL
,
`c14`
varchar
(
240
)
DEFAULT
NULL
,
`c35`
date
NOT
NULL
,
`pk`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`c10`
int
(
10
)
unsigned
NOT
NULL
,
`c6`
int
(
10
)
unsigned
DEFAULT
NULL
,
PRIMARY
KEY
(
`pk`
),
KEY
`c5`
(
`c5`
),
KEY
`c29`
(
`c29`
(
255
)),
KEY
`c3`
(
`c3`
),
KEY
`c25`
(
`c25`
(
255
)),
KEY
`c17`
(
`c17`
),
KEY
`c11`
(
`c11`
),
KEY
`c13`
(
`c13`
),
KEY
`c19`
(
`c19`
(
255
)),
KEY
`c23`
(
`c23`
(
255
)),
KEY
`c27`
(
`c27`
(
255
)),
KEY
`c31`
(
`c31`
),
KEY
`c33`
(
`c33`
),
KEY
`c21`
(
`c21`
(
255
)),
KEY
`c1`
(
`c1`
),
KEY
`c15`
(
`c15`
),
KEY
`c9`
(
`c9`
),
KEY
`c7`
(
`c7`
),
KEY
`c35`
(
`c35`
)
);
CREATE
TABLE
`t2`
(
`c12`
varchar
(
240
)
DEFAULT
NULL
,
`c15`
varchar
(
240
)
DEFAULT
NULL
,
`c19`
blob
,
`c14`
varchar
(
240
)
DEFAULT
NULL
,
`c6`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c11`
int
(
10
)
unsigned
NOT
NULL
,
`c30`
date
DEFAULT
NULL
,
`c29`
text
NOT
NULL
,
`c20`
blob
,
`c18`
blob
,
`c23`
blob
NOT
NULL
,
`c16`
varchar
(
240
)
NOT
NULL
,
`c10`
int
(
10
)
unsigned
NOT
NULL
,
`c25`
text
,
`c21`
blob
,
`c7`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c9`
int
(
11
)
NOT
NULL
,
`c5`
int
(
11
)
DEFAULT
NULL
,
`c35`
date
NOT
NULL
,
`c24`
text
,
`c17`
varchar
(
240
)
NOT
NULL
,
`c28`
text
NOT
NULL
,
`c33`
date
DEFAULT
NULL
,
`c26`
text
,
`c0`
int
(
11
)
DEFAULT
NULL
,
`c13`
varchar
(
240
)
DEFAULT
NULL
,
`c3`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c1`
int
(
11
)
DEFAULT
NULL
,
`pk`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`c34`
date
NOT
NULL
,
`c2`
int
(
10
)
unsigned
DEFAULT
NULL
,
`c4`
int
(
11
)
DEFAULT
NULL
,
`c32`
date
,
`c27`
text
,
`c8`
int
(
11
)
NOT
NULL
,
`c31`
date
DEFAULT
NULL
,
`c22`
blob
NOT
NULL
,
PRIMARY
KEY
(
`pk`
),
KEY
`c15`
(
`c15`
),
KEY
`c19`
(
`c19`
(
255
)),
KEY
`c11`
(
`c11`
),
KEY
`c29`
(
`c29`
(
255
)),
KEY
`c23`
(
`c23`
(
255
)),
KEY
`c25`
(
`c25`
(
255
)),
KEY
`c21`
(
`c21`
(
255
)),
KEY
`c7`
(
`c7`
),
KEY
`c9`
(
`c9`
),
KEY
`c5`
(
`c5`
),
KEY
`c35`
(
`c35`
),
KEY
`c17`
(
`c17`
),
KEY
`c33`
(
`c33`
),
KEY
`c13`
(
`c13`
),
KEY
`c3`
(
`c3`
),
KEY
`c1`
(
`c1`
),
KEY
`c27`
(
`c27`
(
255
)),
KEY
`c31`
(
`c31`
)
);
LOAD
DATA
INFILE
'leak172_t1.data'
INTO
TABLE
`t1`
fields
terminated
by
','
;
connect
(
conn1
,
localhost
,
root
,,);
send
LOAD
DATA
INFILE
'leak172_t2.data'
INTO
TABLE
`t2`
;
connection
default
;
sleep
1
;
--
error
1205
UPDATE
t1
,
t2
SET
t1
.
`c5`
=
4
WHERE
t1
.
`c6`
<=
'o'
;
connection
conn1
;
reap
;
connection
default
;
disconnect
conn1
;
drop
table
t1
,
t2
;
\ No newline at end of file
storage/tokudb/ha_tokudb.cc
View file @
2ea52a40
...
@@ -4368,6 +4368,7 @@ void ha_tokudb::column_bitmaps_signal() {
...
@@ -4368,6 +4368,7 @@ void ha_tokudb::column_bitmaps_signal() {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
prepare_index_scan
()
{
int
ha_tokudb
::
prepare_index_scan
()
{
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
int
error
=
0
;
int
error
=
0
;
HANDLE_INVALID_CURSOR
();
HANDLE_INVALID_CURSOR
();
error
=
prelock_range
(
NULL
,
NULL
);
error
=
prelock_range
(
NULL
,
NULL
);
...
@@ -4376,7 +4377,7 @@ int ha_tokudb::prepare_index_scan() {
...
@@ -4376,7 +4377,7 @@ int ha_tokudb::prepare_index_scan() {
range_lock_grabbed
=
true
;
range_lock_grabbed
=
true
;
error
=
0
;
error
=
0
;
cleanup:
cleanup:
return
error
;
TOKUDB_HANDLER_DBUG_RETURN
(
error
)
;
}
}
...
@@ -4388,6 +4389,7 @@ cleanup:
...
@@ -4388,6 +4389,7 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
prepare_index_key_scan
(
const
uchar
*
key
,
uint
key_len
)
{
int
ha_tokudb
::
prepare_index_key_scan
(
const
uchar
*
key
,
uint
key_len
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
int
error
=
0
;
int
error
=
0
;
DBT
start_key
,
end_key
;
DBT
start_key
,
end_key
;
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
...
@@ -4416,9 +4418,7 @@ int ha_tokudb::prepare_index_key_scan(const uchar * key, uint key_len) {
...
@@ -4416,9 +4418,7 @@ int ha_tokudb::prepare_index_key_scan(const uchar * key, uint key_len) {
error
=
0
;
error
=
0
;
cleanup:
cleanup:
if
(
error
)
{
if
(
error
)
{
if
(
error
==
DB_LOCK_NOTGRANTED
)
{
error
=
map_to_handler_error
(
error
);
error
=
HA_ERR_LOCK_WAIT_TIMEOUT
;
}
last_cursor_error
=
error
;
last_cursor_error
=
error
;
//
//
// cursor should be initialized here, but in case it is not,
// cursor should be initialized here, but in case it is not,
...
@@ -4431,7 +4431,7 @@ cleanup:
...
@@ -4431,7 +4431,7 @@ cleanup:
remove_from_trx_handler_list
();
remove_from_trx_handler_list
();
}
}
}
}
return
error
;
TOKUDB_HANDLER_DBUG_RETURN
(
error
)
;
}
}
void
ha_tokudb
::
invalidate_bulk_fetch
()
{
void
ha_tokudb
::
invalidate_bulk_fetch
()
{
...
@@ -4502,6 +4502,7 @@ int ha_tokudb::index_init(uint keynr, bool sorted) {
...
@@ -4502,6 +4502,7 @@ int ha_tokudb::index_init(uint keynr, bool sorted) {
my_error
(
ER_LOCK_WAIT_TIMEOUT
,
MYF
(
0
));
my_error
(
ER_LOCK_WAIT_TIMEOUT
,
MYF
(
0
));
}
}
table
->
status
=
STATUS_NOT_FOUND
;
table
->
status
=
STATUS_NOT_FOUND
;
error
=
map_to_handler_error
(
error
);
last_cursor_error
=
error
;
last_cursor_error
=
error
;
cursor
=
NULL
;
// Safety
cursor
=
NULL
;
// Safety
goto
exit
;
goto
exit
;
...
@@ -4561,9 +4562,7 @@ int ha_tokudb::index_end() {
...
@@ -4561,9 +4562,7 @@ int ha_tokudb::index_end() {
int
ha_tokudb
::
handle_cursor_error
(
int
error
,
int
err_to_return
,
uint
keynr
)
{
int
ha_tokudb
::
handle_cursor_error
(
int
error
,
int
err_to_return
,
uint
keynr
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
if
(
error
)
{
if
(
error
)
{
if
(
error
==
DB_LOCK_NOTGRANTED
)
{
error
=
map_to_handler_error
(
error
);
error
=
HA_ERR_LOCK_WAIT_TIMEOUT
;
}
last_cursor_error
=
error
;
last_cursor_error
=
error
;
table
->
status
=
STATUS_NOT_FOUND
;
table
->
status
=
STATUS_NOT_FOUND
;
if
(
error
==
DB_NOTFOUND
)
{
if
(
error
==
DB_NOTFOUND
)
{
...
@@ -5688,7 +5687,8 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k
...
@@ -5688,7 +5687,8 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k
true
,
true
,
(
cursor_flags
&
DB_SERIALIZABLE
)
!=
0
?
DB_NOTFOUND
:
0
(
cursor_flags
&
DB_SERIALIZABLE
)
!=
0
?
DB_NOTFOUND
:
0
);
);
if
(
error
){
if
(
error
)
{
error
=
map_to_handler_error
(
error
);
last_cursor_error
=
error
;
last_cursor_error
=
error
;
//
//
// cursor should be initialized here, but in case it is not, we still check
// cursor should be initialized here, but in case it is not, we still check
...
@@ -5721,11 +5721,12 @@ cleanup:
...
@@ -5721,11 +5721,12 @@ cleanup:
// Forward scans use read_range_first()/read_range_next().
// Forward scans use read_range_first()/read_range_next().
//
//
int
ha_tokudb
::
prepare_range_scan
(
const
key_range
*
start_key
,
const
key_range
*
end_key
)
{
int
ha_tokudb
::
prepare_range_scan
(
const
key_range
*
start_key
,
const
key_range
*
end_key
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
int
error
=
prelock_range
(
start_key
,
end_key
);
int
error
=
prelock_range
(
start_key
,
end_key
);
if
(
!
error
)
{
if
(
!
error
)
{
range_lock_grabbed
=
true
;
range_lock_grabbed
=
true
;
}
}
return
error
;
TOKUDB_HANDLER_DBUG_RETURN
(
error
)
;
}
}
int
ha_tokudb
::
read_range_first
(
int
ha_tokudb
::
read_range_first
(
...
@@ -5734,13 +5735,14 @@ int ha_tokudb::read_range_first(
...
@@ -5734,13 +5735,14 @@ int ha_tokudb::read_range_first(
bool
eq_range
,
bool
eq_range
,
bool
sorted
)
bool
sorted
)
{
{
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
int
error
=
prelock_range
(
start_key
,
end_key
);
int
error
=
prelock_range
(
start_key
,
end_key
);
if
(
error
)
{
goto
cleanup
;
}
if
(
error
)
{
goto
cleanup
;
}
range_lock_grabbed
=
true
;
range_lock_grabbed
=
true
;
error
=
handler
::
read_range_first
(
start_key
,
end_key
,
eq_range
,
sorted
);
error
=
handler
::
read_range_first
(
start_key
,
end_key
,
eq_range
,
sorted
);
cleanup:
cleanup:
return
error
;
TOKUDB_HANDLER_DBUG_RETURN
(
error
)
;
}
}
int
ha_tokudb
::
read_range_next
()
int
ha_tokudb
::
read_range_next
()
...
@@ -8002,7 +8004,7 @@ void ha_tokudb::restore_drop_indexes(TABLE *table_arg, uint *key_num, uint num_o
...
@@ -8002,7 +8004,7 @@ void ha_tokudb::restore_drop_indexes(TABLE *table_arg, uint *key_num, uint num_o
}
}
}
}
void
ha_tokudb
::
print_error
(
int
error
,
myf
errflag
)
{
int
ha_tokudb
::
map_to_handler_error
(
int
error
)
{
if
(
error
==
DB_LOCK_DEADLOCK
)
if
(
error
==
DB_LOCK_DEADLOCK
)
error
=
HA_ERR_LOCK_DEADLOCK
;
error
=
HA_ERR_LOCK_DEADLOCK
;
if
(
error
==
DB_LOCK_NOTGRANTED
)
if
(
error
==
DB_LOCK_NOTGRANTED
)
...
@@ -8020,9 +8022,13 @@ void ha_tokudb::print_error(int error, myf errflag) {
...
@@ -8020,9 +8022,13 @@ void ha_tokudb::print_error(int error, myf errflag) {
error
=
HA_ERR_UNSUPPORTED
;
error
=
HA_ERR_UNSUPPORTED
;
}
}
#endif
#endif
handler
::
print_error
(
error
,
errflag
)
;
return
error
;
}
}
void
ha_tokudb
::
print_error
(
int
error
,
myf
errflag
)
{
error
=
map_to_handler_error
(
error
);
handler
::
print_error
(
error
,
errflag
);
}
//
//
// truncate's dictionary associated with keynr index using transaction txn
// truncate's dictionary associated with keynr index using transaction txn
...
...
storage/tokudb/ha_tokudb.h
View file @
2ea52a40
...
@@ -797,6 +797,9 @@ private:
...
@@ -797,6 +797,9 @@ private:
LIST
trx_handler_list
;
LIST
trx_handler_list
;
void
add_to_trx_handler_list
();
void
add_to_trx_handler_list
();
void
remove_from_trx_handler_list
();
void
remove_from_trx_handler_list
();
private:
int
map_to_handler_error
(
int
error
);
};
};
#if defined(MARIADB_BASE_VERSION)
#if defined(MARIADB_BASE_VERSION)
...
...
storage/tokudb/ha_tokudb_admin.cc
View file @
2ea52a40
...
@@ -127,7 +127,7 @@ static int analyze_progress(void *v_extra, uint64_t rows) {
...
@@ -127,7 +127,7 @@ static int analyze_progress(void *v_extra, uint64_t rows) {
}
}
int
ha_tokudb
::
analyze
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
int
ha_tokudb
::
analyze
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
"
"
);
TOKUDB_HANDLER_DBUG_ENTER
(
"
%s"
,
share
->
table_name
);
uint64_t
rec_per_key
[
table_share
->
key_parts
];
uint64_t
rec_per_key
[
table_share
->
key_parts
];
int
result
=
HA_ADMIN_OK
;
int
result
=
HA_ADMIN_OK
;
DB_TXN
*
txn
=
transaction
;
DB_TXN
*
txn
=
transaction
;
...
@@ -153,11 +153,10 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
...
@@ -153,11 +153,10 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
}
else
{
}
else
{
// debug
// debug
if
(
tokudb_debug
&
TOKUDB_DEBUG_ANALYZE
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_ANALYZE
)
{
fprintf
(
stderr
,
"ha_tokudb::analyze %s.%s.%s
"
,
TOKUDB_HANDLER_TRACE
(
"%s.%s.%s
"
,
table_share
->
db
.
str
,
table_share
->
table_name
.
str
,
i
==
primary_key
?
"primary"
:
table_share
->
key_info
[
i
].
name
);
table_share
->
db
.
str
,
table_share
->
table_name
.
str
,
i
==
primary_key
?
"primary"
:
table_share
->
key_info
[
i
].
name
);
for
(
uint
j
=
0
;
j
<
num_key_parts
;
j
++
)
for
(
uint
j
=
0
;
j
<
num_key_parts
;
j
++
)
fprintf
(
stderr
,
"%lu "
,
rec_per_key
[
next_key_part
+
j
]);
TOKUDB_HANDLER_TRACE
(
"%lu"
,
rec_per_key
[
next_key_part
+
j
]);
fprintf
(
stderr
,
"
\n
"
);
}
}
}
}
next_key_part
+=
num_key_parts
;
next_key_part
+=
num_key_parts
;
...
@@ -192,7 +191,7 @@ static int hot_poll_fun(void *extra, float progress) {
...
@@ -192,7 +191,7 @@ static int hot_poll_fun(void *extra, float progress) {
// flatten all DB's in this table, to do so, peform hot optimize on each db
// flatten all DB's in this table, to do so, peform hot optimize on each db
int
ha_tokudb
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
int
ha_tokudb
::
optimize
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
"
"
);
TOKUDB_HANDLER_DBUG_ENTER
(
"
%s"
,
share
->
table_name
);
int
error
;
int
error
;
uint
curr_num_DBs
=
table
->
s
->
keys
+
tokudb_test
(
hidden_primary_key
);
uint
curr_num_DBs
=
table
->
s
->
keys
+
tokudb_test
(
hidden_primary_key
);
...
@@ -262,7 +261,7 @@ static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) {
...
@@ -262,7 +261,7 @@ static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) {
}
}
int
ha_tokudb
::
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
int
ha_tokudb
::
check
(
THD
*
thd
,
HA_CHECK_OPT
*
check_opt
)
{
TOKUDB_HANDLER_DBUG_ENTER
(
"
"
);
TOKUDB_HANDLER_DBUG_ENTER
(
"
%s"
,
share
->
table_name
);
const
char
*
old_proc_info
=
thd
->
proc_info
;
const
char
*
old_proc_info
=
thd
->
proc_info
;
thd_proc_info
(
thd
,
"tokudb::check"
);
thd_proc_info
(
thd
,
"tokudb::check"
);
...
@@ -288,7 +287,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
...
@@ -288,7 +287,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
ha_tokudb_check_info
(
thd
,
table
,
write_status_msg
);
ha_tokudb_check_info
(
thd
,
table
,
write_status_msg
);
time_t
now
=
time
(
0
);
time_t
now
=
time
(
0
);
char
timebuf
[
32
];
char
timebuf
[
32
];
fprintf
(
stderr
,
"%.24s ha_tokudb::check %s
\n
"
,
ctime_r
(
&
now
,
timebuf
),
write_status_msg
);
TOKUDB_HANDLER_TRACE
(
"%.24s %s
"
,
ctime_r
(
&
now
,
timebuf
),
write_status_msg
);
}
}
for
(
uint
i
=
0
;
i
<
num_DBs
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
num_DBs
;
i
++
)
{
DB
*
db
=
share
->
key_file
[
i
];
DB
*
db
=
share
->
key_file
[
i
];
...
@@ -299,7 +298,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
...
@@ -299,7 +298,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
ha_tokudb_check_info
(
thd
,
table
,
write_status_msg
);
ha_tokudb_check_info
(
thd
,
table
,
write_status_msg
);
time_t
now
=
time
(
0
);
time_t
now
=
time
(
0
);
char
timebuf
[
32
];
char
timebuf
[
32
];
fprintf
(
stderr
,
"%.24s ha_tokudb::check %s
\n
"
,
ctime_r
(
&
now
,
timebuf
),
write_status_msg
);
TOKUDB_HANDLER_TRACE
(
"%.24s %s
"
,
ctime_r
(
&
now
,
timebuf
),
write_status_msg
);
}
}
struct
check_context
check_context
=
{
thd
};
struct
check_context
check_context
=
{
thd
};
r
=
db
->
verify_with_progress
(
db
,
ha_tokudb_check_progress
,
&
check_context
,
(
tokudb_debug
&
TOKUDB_DEBUG_CHECK
)
!=
0
,
keep_going
);
r
=
db
->
verify_with_progress
(
db
,
ha_tokudb_check_progress
,
&
check_context
,
(
tokudb_debug
&
TOKUDB_DEBUG_CHECK
)
!=
0
,
keep_going
);
...
@@ -309,7 +308,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
...
@@ -309,7 +308,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
ha_tokudb_check_info
(
thd
,
table
,
write_status_msg
);
ha_tokudb_check_info
(
thd
,
table
,
write_status_msg
);
time_t
now
=
time
(
0
);
time_t
now
=
time
(
0
);
char
timebuf
[
32
];
char
timebuf
[
32
];
fprintf
(
stderr
,
"%.24s ha_tokudb::check %s
\n
"
,
ctime_r
(
&
now
,
timebuf
),
write_status_msg
);
TOKUDB_HANDLER_TRACE
(
"%.24s %s
"
,
ctime_r
(
&
now
,
timebuf
),
write_status_msg
);
}
}
if
(
result
==
HA_ADMIN_OK
&&
r
!=
0
)
{
if
(
result
==
HA_ADMIN_OK
&&
r
!=
0
)
{
result
=
HA_ADMIN_CORRUPT
;
result
=
HA_ADMIN_CORRUPT
;
...
...
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