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
c7836bb3
Commit
c7836bb3
authored
Jan 14, 2014
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#166 add this handler to debug enter and return
parent
3a789b41
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
201 additions
and
185 deletions
+201
-185
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+127
-126
storage/tokudb/ha_tokudb_admin.cc
storage/tokudb/ha_tokudb_admin.cc
+6
-6
storage/tokudb/ha_tokudb_alter_56.cc
storage/tokudb/ha_tokudb_alter_56.cc
+4
-4
storage/tokudb/ha_tokudb_update.cc
storage/tokudb/ha_tokudb_update.cc
+4
-4
storage/tokudb/hatoku_defines.h
storage/tokudb/hatoku_defines.h
+23
-8
storage/tokudb/hatoku_hton.cc
storage/tokudb/hatoku_hton.cc
+37
-37
No files found.
storage/tokudb/ha_tokudb.cc
View file @
c7836bb3
...
@@ -301,7 +301,7 @@ static int free_share(TOKUDB_SHARE * share) {
...
@@ -301,7 +301,7 @@ static int free_share(TOKUDB_SHARE * share) {
for
(
uint
i
=
0
;
i
<
sizeof
(
share
->
key_file
)
/
sizeof
(
share
->
key_file
[
0
]);
i
++
)
{
for
(
uint
i
=
0
;
i
<
sizeof
(
share
->
key_file
)
/
sizeof
(
share
->
key_file
[
0
]);
i
++
)
{
if
(
share
->
key_file
[
i
])
{
if
(
share
->
key_file
[
i
])
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
TOKUDB_TRACE
(
"dbclose:%p
\n
"
,
share
->
key_file
[
i
]);
TOKUDB_TRACE
(
"dbclose:%p"
,
share
->
key_file
[
i
]);
}
}
error
=
share
->
key_file
[
i
]
->
close
(
share
->
key_file
[
i
],
0
);
error
=
share
->
key_file
[
i
]
->
close
(
share
->
key_file
[
i
],
0
);
assert
(
error
==
0
);
assert
(
error
==
0
);
...
@@ -363,7 +363,7 @@ const char *ha_tokudb::index_type(uint inx) {
...
@@ -363,7 +363,7 @@ const char *ha_tokudb::index_type(uint inx) {
* returns NULL terminated file extension string
* returns NULL terminated file extension string
*/
*/
const
char
**
ha_tokudb
::
bas_ext
()
const
{
const
char
**
ha_tokudb
::
bas_ext
()
const
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::bas_ext
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBUG_RETURN
(
ha_tokudb_exts
);
DBUG_RETURN
(
ha_tokudb_exts
);
}
}
...
@@ -423,7 +423,7 @@ ulonglong ha_tokudb::table_flags() const {
...
@@ -423,7 +423,7 @@ ulonglong ha_tokudb::table_flags() const {
// the arguments. The capabilities are defined in sql/handler.h.
// the arguments. The capabilities are defined in sql/handler.h.
//
//
ulong
ha_tokudb
::
index_flags
(
uint
idx
,
uint
part
,
bool
all_parts
)
const
{
ulong
ha_tokudb
::
index_flags
(
uint
idx
,
uint
part
,
bool
all_parts
)
const
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_flags
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
assert
(
table_share
);
assert
(
table_share
);
ulong
flags
=
(
HA_READ_NEXT
|
HA_READ_PREV
|
HA_READ_ORDER
|
HA_KEYREAD_ONLY
|
HA_READ_RANGE
);
ulong
flags
=
(
HA_READ_NEXT
|
HA_READ_PREV
|
HA_READ_ORDER
|
HA_KEYREAD_ONLY
|
HA_READ_RANGE
);
#if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
#if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
...
@@ -1286,7 +1286,7 @@ static int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn) {
...
@@ -1286,7 +1286,7 @@ static int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn) {
}
}
make_name
(
newname
,
name
,
"status"
);
make_name
(
newname
,
name
,
"status"
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
TOKUDB_TRACE
(
"open:%s
\n
"
,
newname
);
TOKUDB_TRACE
(
"open:%s"
,
newname
);
}
}
error
=
tokudb
::
open_status
(
db_env
,
ptr
,
newname
,
txn
);
error
=
tokudb
::
open_status
(
db_env
,
ptr
,
newname
,
txn
);
...
@@ -1325,7 +1325,7 @@ int ha_tokudb::open_main_dictionary(const char* name, bool is_read_only, DB_TXN*
...
@@ -1325,7 +1325,7 @@ int ha_tokudb::open_main_dictionary(const char* name, bool is_read_only, DB_TXN*
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
TOKUDB_TRACE
(
"open:%s:file=%p
\n
"
,
newname
,
share
->
file
);
TOKUDB_TRACE
(
"open:%s:file=%p"
,
newname
,
share
->
file
);
}
}
error
=
0
;
error
=
0
;
...
@@ -1377,7 +1377,7 @@ int ha_tokudb::open_secondary_dictionary(DB** ptr, KEY* key_info, const char* na
...
@@ -1377,7 +1377,7 @@ int ha_tokudb::open_secondary_dictionary(DB** ptr, KEY* key_info, const char* na
goto
cleanup
;
goto
cleanup
;
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
TOKUDB_TRACE
(
"open:%s:file=%p
\n
"
,
newname
,
*
ptr
);
TOKUDB_TRACE
(
"open:%s:file=%p"
,
newname
,
*
ptr
);
}
}
cleanup:
cleanup:
if
(
error
)
{
if
(
error
)
{
...
@@ -1741,7 +1741,7 @@ exit:
...
@@ -1741,7 +1741,7 @@ exit:
// 1 on error
// 1 on error
//
//
int
ha_tokudb
::
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
{
int
ha_tokudb
::
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::open %p %s %o %u"
,
this
,
name
,
mode
,
test_if_locked
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%s %o %u"
,
name
,
mode
,
test_if_locked
);
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
int
error
=
0
;
int
error
=
0
;
...
@@ -1849,7 +1849,7 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
...
@@ -1849,7 +1849,7 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
ref_length
=
share
->
ref_length
;
// If second open
ref_length
=
share
->
ref_length
;
// If second open
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
TOKUDB_TRACE
(
"tokudbopen:%p:share=%p:file=%p:table=%p:table->s=%p:%d
\n
"
,
TOKUDB_TRACE
(
"tokudbopen:%p:share=%p:file=%p:table=%p:table->s=%p:%d"
,
this
,
share
,
share
->
file
,
table
,
table
->
s
,
share
->
use_count
);
this
,
share
,
share
->
file
,
table
,
table
->
s
,
share
->
use_count
);
}
}
...
@@ -1875,7 +1875,7 @@ exit:
...
@@ -1875,7 +1875,7 @@ exit:
my_errno
=
error
;
my_errno
=
error
;
}
}
}
}
TOKUDB_DBUG_RETURN
(
ret_val
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
ret_val
);
}
}
//
//
...
@@ -2022,7 +2022,7 @@ cleanup:
...
@@ -2022,7 +2022,7 @@ cleanup:
}
}
int
ha_tokudb
::
write_frm_data
(
DB
*
db
,
DB_TXN
*
txn
,
const
char
*
frm_name
)
{
int
ha_tokudb
::
write_frm_data
(
DB
*
db
,
DB_TXN
*
txn
,
const
char
*
frm_name
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::write_frm_data %p %p %p %s"
,
this
,
db
,
txn
,
frm_name
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%p %p %s"
,
db
,
txn
,
frm_name
);
uchar
*
frm_data
=
NULL
;
uchar
*
frm_data
=
NULL
;
size_t
frm_len
=
0
;
size_t
frm_len
=
0
;
...
@@ -2037,7 +2037,7 @@ int ha_tokudb::write_frm_data(DB* db, DB_TXN* txn, const char* frm_name) {
...
@@ -2037,7 +2037,7 @@ int ha_tokudb::write_frm_data(DB* db, DB_TXN* txn, const char* frm_name) {
error
=
0
;
error
=
0
;
cleanup:
cleanup:
tokudb_my_free
(
frm_data
);
tokudb_my_free
(
frm_data
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
int
ha_tokudb
::
remove_frm_data
(
DB
*
db
,
DB_TXN
*
txn
)
{
int
ha_tokudb
::
remove_frm_data
(
DB
*
db
,
DB_TXN
*
txn
)
{
...
@@ -2055,7 +2055,7 @@ smart_dbt_callback_verify_frm (DBT const *key, DBT const *row, void *context) {
...
@@ -2055,7 +2055,7 @@ smart_dbt_callback_verify_frm (DBT const *key, DBT const *row, void *context) {
}
}
int
ha_tokudb
::
verify_frm_data
(
const
char
*
frm_name
,
DB_TXN
*
txn
)
{
int
ha_tokudb
::
verify_frm_data
(
const
char
*
frm_name
,
DB_TXN
*
txn
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::verify_frm_data
%s"
,
frm_name
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
%s"
,
frm_name
);
uchar
*
mysql_frm_data
=
NULL
;
uchar
*
mysql_frm_data
=
NULL
;
size_t
mysql_frm_len
=
0
;
size_t
mysql_frm_len
=
0
;
DBT
key
,
stored_frm
;
DBT
key
,
stored_frm
;
...
@@ -2102,7 +2102,7 @@ int ha_tokudb::verify_frm_data(const char* frm_name, DB_TXN* txn) {
...
@@ -2102,7 +2102,7 @@ int ha_tokudb::verify_frm_data(const char* frm_name, DB_TXN* txn) {
cleanup:
cleanup:
tokudb_my_free
(
mysql_frm_data
);
tokudb_my_free
(
mysql_frm_data
);
tokudb_my_free
(
stored_frm
.
data
);
tokudb_my_free
(
stored_frm
.
data
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -2138,14 +2138,15 @@ int ha_tokudb::write_auto_inc_create(DB* db, ulonglong val, DB_TXN* txn){
...
@@ -2138,14 +2138,15 @@ int ha_tokudb::write_auto_inc_create(DB* db, ulonglong val, DB_TXN* txn){
// Closes a handle to a table.
// Closes a handle to a table.
//
//
int
ha_tokudb
::
close
(
void
)
{
int
ha_tokudb
::
close
(
void
)
{
TOKUDB_DBUG_ENTER
(
"ha_tokudb::close %p"
,
this
);
TOKUDB_HANDLER_DBUG_ENTER
(
""
);
TOKUDB_DBUG_RETURN
(
__close
());
int
r
=
__close
();
TOKUDB_HANDLER_DBUG_RETURN
(
r
);
}
}
int
ha_tokudb
::
__close
()
{
int
ha_tokudb
::
__close
()
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::__close %p"
,
this
);
TOKUDB_
HANDLER_DBUG_ENTER
(
""
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
TOKUDB_TRACE
(
"close:%p
\n
"
,
this
);
TOKUDB_TRACE
(
"close:%p"
,
this
);
tokudb_my_free
(
rec_buff
);
tokudb_my_free
(
rec_buff
);
tokudb_my_free
(
rec_update_buff
);
tokudb_my_free
(
rec_update_buff
);
tokudb_my_free
(
blob_buff
);
tokudb_my_free
(
blob_buff
);
...
@@ -2162,7 +2163,7 @@ int ha_tokudb::__close() {
...
@@ -2162,7 +2163,7 @@ int ha_tokudb::__close() {
alloc_ptr
=
NULL
;
alloc_ptr
=
NULL
;
ha_tokudb
::
reset
();
ha_tokudb
::
reset
();
int
retval
=
free_share
(
share
);
int
retval
=
free_share
(
share
);
TOKUDB_DBUG_RETURN
(
retval
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
retval
);
}
}
//
//
...
@@ -2751,7 +2752,7 @@ DBT *ha_tokudb::create_dbt_key_from_table(
...
@@ -2751,7 +2752,7 @@ DBT *ha_tokudb::create_dbt_key_from_table(
int
key_length
int
key_length
)
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::create_dbt_key_from_table
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
memset
((
void
*
)
key
,
0
,
sizeof
(
*
key
));
memset
((
void
*
)
key
,
0
,
sizeof
(
*
key
));
if
(
hidden_primary_key
&&
keynr
==
primary_key
)
{
if
(
hidden_primary_key
&&
keynr
==
primary_key
)
{
key
->
data
=
buff
;
key
->
data
=
buff
;
...
@@ -2772,7 +2773,7 @@ DBT* ha_tokudb::create_dbt_key_for_lookup(
...
@@ -2772,7 +2773,7 @@ DBT* ha_tokudb::create_dbt_key_for_lookup(
int
key_length
int
key_length
)
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::create_dbt_key_from_lookup
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
*
ret
=
create_dbt_key_from_key
(
key
,
key_info
,
buff
,
record
,
has_null
,
true
,
key_length
);
DBT
*
ret
=
create_dbt_key_from_key
(
key
,
key_info
,
buff
,
record
,
has_null
,
true
,
key_length
);
// override the infinity byte, needed in case the pk is a string
// override the infinity byte, needed in case the pk is a string
// to make sure that the cursor that uses this key properly positions
// to make sure that the cursor that uses this key properly positions
...
@@ -2804,7 +2805,7 @@ DBT *ha_tokudb::pack_key(
...
@@ -2804,7 +2805,7 @@ DBT *ha_tokudb::pack_key(
int8_t
inf_byte
int8_t
inf_byte
)
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::pack_key
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
#if TOKU_INCLUDE_EXTENDED_KEYS
#if TOKU_INCLUDE_EXTENDED_KEYS
if
(
keynr
!=
primary_key
&&
!
tokudb_test
(
hidden_primary_key
))
{
if
(
keynr
!=
primary_key
&&
!
tokudb_test
(
hidden_primary_key
))
{
DBUG_RETURN
(
pack_ext_key
(
key
,
keynr
,
buff
,
key_ptr
,
key_length
,
inf_byte
));
DBUG_RETURN
(
pack_ext_key
(
key
,
keynr
,
buff
,
key_ptr
,
key_length
,
inf_byte
));
...
@@ -2864,7 +2865,7 @@ DBT *ha_tokudb::pack_ext_key(
...
@@ -2864,7 +2865,7 @@ DBT *ha_tokudb::pack_ext_key(
int8_t
inf_byte
int8_t
inf_byte
)
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::pack_ext_key
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
// build a list of PK parts that are in the SK. we will use this list to build the
// build a list of PK parts that are in the SK. we will use this list to build the
// extended key if necessary.
// extended key if necessary.
...
@@ -2956,7 +2957,7 @@ DBT *ha_tokudb::pack_ext_key(
...
@@ -2956,7 +2957,7 @@ DBT *ha_tokudb::pack_ext_key(
// get max used hidden primary key value
// get max used hidden primary key value
//
//
void
ha_tokudb
::
init_hidden_prim_key_info
()
{
void
ha_tokudb
::
init_hidden_prim_key_info
()
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::init_prim_key_info
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
tokudb_pthread_mutex_lock
(
&
share
->
mutex
);
tokudb_pthread_mutex_lock
(
&
share
->
mutex
);
if
(
!
(
share
->
status
&
STATUS_PRIMARY_KEY_INIT
))
{
if
(
!
(
share
->
status
&
STATUS_PRIMARY_KEY_INIT
))
{
int
error
=
0
;
int
error
=
0
;
...
@@ -3007,7 +3008,7 @@ void ha_tokudb::init_hidden_prim_key_info() {
...
@@ -3007,7 +3008,7 @@ void ha_tokudb::init_hidden_prim_key_info() {
Get metadata info stored in status.tokudb
Get metadata info stored in status.tokudb
*/
*/
int
ha_tokudb
::
get_status
(
DB_TXN
*
txn
)
{
int
ha_tokudb
::
get_status
(
DB_TXN
*
txn
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::get_status
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
key
,
value
;
DBT
key
,
value
;
HA_METADATA_KEY
curr_key
;
HA_METADATA_KEY
curr_key
;
int
error
;
int
error
;
...
@@ -3115,7 +3116,7 @@ int ha_tokudb::get_status(DB_TXN* txn) {
...
@@ -3115,7 +3116,7 @@ int ha_tokudb::get_status(DB_TXN* txn) {
error
=
0
;
error
=
0
;
cleanup:
cleanup:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
/** @brief
/** @brief
...
@@ -3124,7 +3125,7 @@ cleanup:
...
@@ -3124,7 +3125,7 @@ cleanup:
This is used in filesort.cc.
This is used in filesort.cc.
*/
*/
ha_rows
ha_tokudb
::
estimate_rows_upper_bound
()
{
ha_rows
ha_tokudb
::
estimate_rows_upper_bound
()
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::estimate_rows_upper_bound
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBUG_RETURN
(
share
->
rows
+
HA_TOKUDB_EXTRA_ROWS
);
DBUG_RETURN
(
share
->
rows
+
HA_TOKUDB_EXTRA_ROWS
);
}
}
...
@@ -3223,7 +3224,7 @@ cleanup:
...
@@ -3223,7 +3224,7 @@ cleanup:
}
}
void
ha_tokudb
::
start_bulk_insert
(
ha_rows
rows
)
{
void
ha_tokudb
::
start_bulk_insert
(
ha_rows
rows
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::start_bulk_insert %p txn %p"
,
this
,
transaction
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"txn %p"
,
transaction
);
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
tokudb_hton
->
slot
);
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
tokudb_hton
->
slot
);
delay_updating_ai_metadata
=
true
;
delay_updating_ai_metadata
=
true
;
...
@@ -3290,7 +3291,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
...
@@ -3290,7 +3291,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
// this is guaranteed to be called.
// this is guaranteed to be called.
//
//
int
ha_tokudb
::
end_bulk_insert
(
bool
abort
)
{
int
ha_tokudb
::
end_bulk_insert
(
bool
abort
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::end_bulk_insert
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
tokudb_hton
->
slot
);
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
tokudb_hton
->
slot
);
...
@@ -3366,7 +3367,7 @@ cleanup:
...
@@ -3366,7 +3367,7 @@ cleanup:
}
}
}
}
trx
->
stmt_progress
.
using_loader
=
false
;
trx
->
stmt_progress
.
using_loader
=
false
;
TOKUDB_DBUG_RETURN
(
error
?
error
:
loader_error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
?
error
:
loader_error
);
}
}
int
ha_tokudb
::
end_bulk_insert
()
{
int
ha_tokudb
::
end_bulk_insert
()
{
...
@@ -3881,7 +3882,7 @@ out:
...
@@ -3881,7 +3882,7 @@ out:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
write_row
(
uchar
*
record
)
{
int
ha_tokudb
::
write_row
(
uchar
*
record
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::write_row
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
row
,
prim_key
;
DBT
row
,
prim_key
;
int
error
;
int
error
;
...
@@ -4053,7 +4054,7 @@ cleanup:
...
@@ -4053,7 +4054,7 @@ cleanup:
commit_txn
(
sub_trans
,
DB_TXN_NOSYNC
);
commit_txn
(
sub_trans
,
DB_TXN_NOSYNC
);
}
}
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
/* Compare if a key in a row has changed */
/* Compare if a key in a row has changed */
...
@@ -4079,7 +4080,7 @@ bool ha_tokudb::key_changed(uint keynr, const uchar * old_row, const uchar * new
...
@@ -4079,7 +4080,7 @@ bool ha_tokudb::key_changed(uint keynr, const uchar * old_row, const uchar * new
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
update_row
(
const
uchar
*
old_row
,
uchar
*
new_row
)
{
int
ha_tokudb
::
update_row
(
const
uchar
*
old_row
,
uchar
*
new_row
)
{
TOKUDB_
DBUG_ENTER
(
"update_row
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
prim_key
,
old_prim_key
,
prim_row
,
old_prim_row
;
DBT
prim_key
,
old_prim_key
,
prim_row
,
old_prim_row
;
int
error
;
int
error
;
bool
has_null
;
bool
has_null
;
...
@@ -4236,7 +4237,7 @@ cleanup:
...
@@ -4236,7 +4237,7 @@ cleanup:
commit_txn
(
sub_trans
,
DB_TXN_NOSYNC
);
commit_txn
(
sub_trans
,
DB_TXN_NOSYNC
);
}
}
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -4248,7 +4249,7 @@ cleanup:
...
@@ -4248,7 +4249,7 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
delete_row
(
const
uchar
*
record
)
{
int
ha_tokudb
::
delete_row
(
const
uchar
*
record
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::delete_row
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
ENOSYS
;
int
error
=
ENOSYS
;
DBT
row
,
prim_key
;
DBT
row
,
prim_key
;
bool
has_null
;
bool
has_null
;
...
@@ -4297,7 +4298,7 @@ int ha_tokudb::delete_row(const uchar * record) {
...
@@ -4297,7 +4298,7 @@ int ha_tokudb::delete_row(const uchar * record) {
}
}
cleanup:
cleanup:
rw_unlock
(
&
share
->
num_DBs_lock
);
rw_unlock
(
&
share
->
num_DBs_lock
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -4466,7 +4467,7 @@ void ha_tokudb::invalidate_icp() {
...
@@ -4466,7 +4467,7 @@ void ha_tokudb::invalidate_icp() {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_init
(
uint
keynr
,
bool
sorted
)
{
int
ha_tokudb
::
index_init
(
uint
keynr
,
bool
sorted
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_init %p %d"
,
this
,
keynr
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%d"
,
keynr
);
int
error
;
int
error
;
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
...
@@ -4531,14 +4532,14 @@ int ha_tokudb::index_init(uint keynr, bool sorted) {
...
@@ -4531,14 +4532,14 @@ int ha_tokudb::index_init(uint keynr, bool sorted) {
doing_bulk_fetch
=
false
;
doing_bulk_fetch
=
false
;
error
=
0
;
error
=
0
;
exit:
exit:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
// closes the local cursor
// closes the local cursor
//
//
int
ha_tokudb
::
index_end
()
{
int
ha_tokudb
::
index_end
()
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_end %p"
,
this
);
TOKUDB_
HANDLER_DBUG_ENTER
(
""
);
range_lock_grabbed
=
false
;
range_lock_grabbed
=
false
;
if
(
cursor
)
{
if
(
cursor
)
{
DBUG_PRINT
(
"enter"
,
(
"table: '%s'"
,
table_share
->
table_name
.
str
));
DBUG_PRINT
(
"enter"
,
(
"table: '%s'"
,
table_share
->
table_name
.
str
));
...
@@ -4564,12 +4565,12 @@ int ha_tokudb::index_end() {
...
@@ -4564,12 +4565,12 @@ int ha_tokudb::index_end() {
doing_bulk_fetch
=
false
;
doing_bulk_fetch
=
false
;
close_dsmrr
();
close_dsmrr
();
TOKUDB_DBUG_RETURN
(
0
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
0
);
}
}
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_
DBUG_ENTER
(
"ha_tokudb::handle_cursor_error
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
if
(
error
)
{
if
(
error
)
{
if
(
error
==
DB_LOCK_NOTGRANTED
)
{
if
(
error
==
DB_LOCK_NOTGRANTED
)
{
error
=
HA_ERR_LOCK_WAIT_TIMEOUT
;
error
=
HA_ERR_LOCK_WAIT_TIMEOUT
;
...
@@ -4580,7 +4581,7 @@ int ha_tokudb::handle_cursor_error(int error, int err_to_return, uint keynr) {
...
@@ -4580,7 +4581,7 @@ int ha_tokudb::handle_cursor_error(int error, int err_to_return, uint keynr) {
error
=
err_to_return
;
error
=
err_to_return
;
}
}
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -4628,7 +4629,7 @@ int ha_tokudb::read_row_callback (uchar * buf, uint keynr, DBT const *row, DBT c
...
@@ -4628,7 +4629,7 @@ int ha_tokudb::read_row_callback (uchar * buf, uint keynr, DBT const *row, DBT c
// [in] found_key - key used to retrieve the row
// [in] found_key - key used to retrieve the row
//
//
void
ha_tokudb
::
read_key_only
(
uchar
*
buf
,
uint
keynr
,
DBT
const
*
found_key
)
{
void
ha_tokudb
::
read_key_only
(
uchar
*
buf
,
uint
keynr
,
DBT
const
*
found_key
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::read_key_only
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
table
->
status
=
0
;
table
->
status
=
0
;
//
//
// only case when we do not unpack the key is if we are dealing with the main dictionary
// only case when we do not unpack the key is if we are dealing with the main dictionary
...
@@ -4651,7 +4652,7 @@ void ha_tokudb::read_key_only(uchar * buf, uint keynr, DBT const *found_key) {
...
@@ -4651,7 +4652,7 @@ void ha_tokudb::read_key_only(uchar * buf, uint keynr, DBT const *found_key) {
// [in] found_key - key used to retrieve the row
// [in] found_key - key used to retrieve the row
//
//
int
ha_tokudb
::
read_primary_key
(
uchar
*
buf
,
uint
keynr
,
DBT
const
*
row
,
DBT
const
*
found_key
)
{
int
ha_tokudb
::
read_primary_key
(
uchar
*
buf
,
uint
keynr
,
DBT
const
*
row
,
DBT
const
*
found_key
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::read_primary_key
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
table
->
status
=
0
;
table
->
status
=
0
;
//
//
...
@@ -4685,7 +4686,7 @@ int ha_tokudb::read_primary_key(uchar * buf, uint keynr, DBT const *row, DBT con
...
@@ -4685,7 +4686,7 @@ int ha_tokudb::read_primary_key(uchar * buf, uint keynr, DBT const *row, DBT con
if
(
found_key
)
{
DBUG_DUMP
(
"read row key"
,
(
uchar
*
)
found_key
->
data
,
found_key
->
size
);
}
if
(
found_key
)
{
DBUG_DUMP
(
"read row key"
,
(
uchar
*
)
found_key
->
data
,
found_key
->
size
);
}
error
=
0
;
error
=
0
;
exit:
exit:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -4697,7 +4698,7 @@ exit:
...
@@ -4697,7 +4698,7 @@ exit:
// 0 on success, error otherwise
// 0 on success, error otherwise
//
//
int
ha_tokudb
::
read_full_row
(
uchar
*
buf
)
{
int
ha_tokudb
::
read_full_row
(
uchar
*
buf
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::read_full_row
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
struct
smart_dbt_info
info
;
struct
smart_dbt_info
info
;
info
.
ha
=
this
;
info
.
ha
=
this
;
...
@@ -4721,10 +4722,10 @@ int ha_tokudb::read_full_row(uchar * buf) {
...
@@ -4721,10 +4722,10 @@ int ha_tokudb::read_full_row(uchar * buf) {
error
=
HA_ERR_LOCK_WAIT_TIMEOUT
;
error
=
HA_ERR_LOCK_WAIT_TIMEOUT
;
}
}
table
->
status
=
STATUS_NOT_FOUND
;
table
->
status
=
STATUS_NOT_FOUND
;
TOKUDB_DBUG_RETURN
(
error
==
DB_NOTFOUND
?
HA_ERR_CRASHED
:
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
==
DB_NOTFOUND
?
HA_ERR_CRASHED
:
error
);
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -4740,7 +4741,7 @@ int ha_tokudb::read_full_row(uchar * buf) {
...
@@ -4740,7 +4741,7 @@ int ha_tokudb::read_full_row(uchar * buf) {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_next_same
(
uchar
*
buf
,
const
uchar
*
key
,
uint
keylen
)
{
int
ha_tokudb
::
index_next_same
(
uchar
*
buf
,
const
uchar
*
key
,
uint
keylen
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_next_same
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
ha_statistic_increment
(
&
SSV
::
ha_read_next_count
);
ha_statistic_increment
(
&
SSV
::
ha_read_next_count
);
DBT
curr_key
;
DBT
curr_key
;
...
@@ -4765,7 +4766,7 @@ int ha_tokudb::index_next_same(uchar * buf, const uchar * key, uint keylen) {
...
@@ -4765,7 +4766,7 @@ int ha_tokudb::index_next_same(uchar * buf, const uchar * key, uint keylen) {
cleanup:
cleanup:
error
=
handle_cursor_error
(
error
,
HA_ERR_END_OF_FILE
,
tokudb_active_index
);
error
=
handle_cursor_error
(
error
,
HA_ERR_END_OF_FILE
,
tokudb_active_index
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -4787,7 +4788,7 @@ cleanup:
...
@@ -4787,7 +4788,7 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_read
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
int
ha_tokudb
::
index_read
(
uchar
*
buf
,
const
uchar
*
key
,
uint
key_len
,
enum
ha_rkey_function
find_flag
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_read %p find %d"
,
this
,
find_flag
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"find %d"
,
find_flag
);
invalidate_bulk_fetch
();
invalidate_bulk_fetch
();
// TOKUDB_DBUG_DUMP("key=", key, key_len);
// TOKUDB_DBUG_DUMP("key=", key, key_len);
DBT
row
;
DBT
row
;
...
@@ -4867,7 +4868,7 @@ int ha_tokudb::index_read(uchar * buf, const uchar * key, uint key_len, enum ha_
...
@@ -4867,7 +4868,7 @@ int ha_tokudb::index_read(uchar * buf, const uchar * key, uint key_len, enum ha_
}
}
break
;
break
;
default:
default:
TOKUDB_TRACE
(
"unsupported:%d
\n
"
,
find_flag
);
TOKUDB_TRACE
(
"unsupported:%d"
,
find_flag
);
error
=
HA_ERR_UNSUPPORTED
;
error
=
HA_ERR_UNSUPPORTED
;
break
;
break
;
}
}
...
@@ -4877,13 +4878,13 @@ int ha_tokudb::index_read(uchar * buf, const uchar * key, uint key_len, enum ha_
...
@@ -4877,13 +4878,13 @@ int ha_tokudb::index_read(uchar * buf, const uchar * key, uint key_len, enum ha_
}
}
if
(
error
&&
(
tokudb_debug
&
TOKUDB_DEBUG_ERROR
))
{
if
(
error
&&
(
tokudb_debug
&
TOKUDB_DEBUG_ERROR
))
{
TOKUDB_TRACE
(
"error:%d:%d
\n
"
,
error
,
find_flag
);
TOKUDB_TRACE
(
"error:%d:%d"
,
error
,
find_flag
);
}
}
trx
->
stmt_progress
.
queried
++
;
trx
->
stmt_progress
.
queried
++
;
track_progress
(
thd
);
track_progress
(
thd
);
cleanup:
cleanup:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -5377,10 +5378,10 @@ cleanup:
...
@@ -5377,10 +5378,10 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_next
(
uchar
*
buf
)
{
int
ha_tokudb
::
index_next
(
uchar
*
buf
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_next
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
ha_statistic_increment
(
&
SSV
::
ha_read_next_count
);
ha_statistic_increment
(
&
SSV
::
ha_read_next_count
);
int
error
=
get_next
(
buf
,
1
,
NULL
,
key_read
);
int
error
=
get_next
(
buf
,
1
,
NULL
,
key_read
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -5399,10 +5400,10 @@ int ha_tokudb::index_read_last(uchar * buf, const uchar * key, uint key_len) {
...
@@ -5399,10 +5400,10 @@ int ha_tokudb::index_read_last(uchar * buf, const uchar * key, uint key_len) {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_prev
(
uchar
*
buf
)
{
int
ha_tokudb
::
index_prev
(
uchar
*
buf
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_prev
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
ha_statistic_increment
(
&
SSV
::
ha_read_prev_count
);
ha_statistic_increment
(
&
SSV
::
ha_read_prev_count
);
int
error
=
get_next
(
buf
,
-
1
,
NULL
,
key_read
);
int
error
=
get_next
(
buf
,
-
1
,
NULL
,
key_read
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -5415,7 +5416,7 @@ int ha_tokudb::index_prev(uchar * buf) {
...
@@ -5415,7 +5416,7 @@ int ha_tokudb::index_prev(uchar * buf) {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_first
(
uchar
*
buf
)
{
int
ha_tokudb
::
index_first
(
uchar
*
buf
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_first
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
invalidate_bulk_fetch
();
invalidate_bulk_fetch
();
int
error
=
0
;
int
error
=
0
;
struct
smart_dbt_info
info
;
struct
smart_dbt_info
info
;
...
@@ -5445,7 +5446,7 @@ int ha_tokudb::index_first(uchar * buf) {
...
@@ -5445,7 +5446,7 @@ int ha_tokudb::index_first(uchar * buf) {
track_progress
(
thd
);
track_progress
(
thd
);
cleanup:
cleanup:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -5458,7 +5459,7 @@ cleanup:
...
@@ -5458,7 +5459,7 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
index_last
(
uchar
*
buf
)
{
int
ha_tokudb
::
index_last
(
uchar
*
buf
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_last
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
invalidate_bulk_fetch
();
invalidate_bulk_fetch
();
int
error
=
0
;
int
error
=
0
;
struct
smart_dbt_info
info
;
struct
smart_dbt_info
info
;
...
@@ -5489,7 +5490,7 @@ int ha_tokudb::index_last(uchar * buf) {
...
@@ -5489,7 +5490,7 @@ int ha_tokudb::index_last(uchar * buf) {
}
}
track_progress
(
thd
);
track_progress
(
thd
);
cleanup:
cleanup:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -5501,7 +5502,7 @@ cleanup:
...
@@ -5501,7 +5502,7 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
rnd_init
(
bool
scan
)
{
int
ha_tokudb
::
rnd_init
(
bool
scan
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::rnd_init
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
range_lock_grabbed
=
false
;
range_lock_grabbed
=
false
;
error
=
index_init
(
MAX_KEY
,
0
);
error
=
index_init
(
MAX_KEY
,
0
);
...
@@ -5524,16 +5525,16 @@ cleanup:
...
@@ -5524,16 +5525,16 @@ cleanup:
index_end
();
index_end
();
last_cursor_error
=
error
;
last_cursor_error
=
error
;
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
// End a scan of the table
// End a scan of the table
//
//
int
ha_tokudb
::
rnd_end
()
{
int
ha_tokudb
::
rnd_end
()
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::rnd_end
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
range_lock_grabbed
=
false
;
range_lock_grabbed
=
false
;
TOKUDB_DBUG_RETURN
(
index_end
());
TOKUDB_
HANDLER_
DBUG_RETURN
(
index_end
());
}
}
...
@@ -5547,10 +5548,10 @@ int ha_tokudb::rnd_end() {
...
@@ -5547,10 +5548,10 @@ int ha_tokudb::rnd_end() {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
rnd_next
(
uchar
*
buf
)
{
int
ha_tokudb
::
rnd_next
(
uchar
*
buf
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::rnd_next
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
ha_statistic_increment
(
&
SSV
::
ha_read_rnd_next_count
);
ha_statistic_increment
(
&
SSV
::
ha_read_rnd_next_count
);
int
error
=
get_next
(
buf
,
1
,
NULL
,
false
);
int
error
=
get_next
(
buf
,
1
,
NULL
,
false
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -5602,7 +5603,7 @@ void ha_tokudb::track_progress(THD* thd) {
...
@@ -5602,7 +5603,7 @@ void ha_tokudb::track_progress(THD* thd) {
DBT
*
ha_tokudb
::
get_pos
(
DBT
*
to
,
uchar
*
pos
)
{
DBT
*
ha_tokudb
::
get_pos
(
DBT
*
to
,
uchar
*
pos
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::get_pos
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
/* We don't need to set app_data here */
/* We don't need to set app_data here */
memset
((
void
*
)
to
,
0
,
sizeof
(
*
to
));
memset
((
void
*
)
to
,
0
,
sizeof
(
*
to
));
to
->
data
=
pos
+
sizeof
(
uint32_t
);
to
->
data
=
pos
+
sizeof
(
uint32_t
);
...
@@ -5619,7 +5620,7 @@ DBT *ha_tokudb::get_pos(DBT * to, uchar * pos) {
...
@@ -5619,7 +5620,7 @@ DBT *ha_tokudb::get_pos(DBT * to, uchar * pos) {
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
rnd_pos
(
uchar
*
buf
,
uchar
*
pos
)
{
int
ha_tokudb
::
rnd_pos
(
uchar
*
buf
,
uchar
*
pos
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::rnd_pos
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
db_pos
;
DBT
db_pos
;
int
error
=
0
;
int
error
=
0
;
struct
smart_dbt_info
info
;
struct
smart_dbt_info
info
;
...
@@ -5644,11 +5645,11 @@ int ha_tokudb::rnd_pos(uchar * buf, uchar * pos) {
...
@@ -5644,11 +5645,11 @@ int ha_tokudb::rnd_pos(uchar * buf, uchar * pos) {
}
}
cleanup:
cleanup:
unpack_entire_row
=
old_unpack_entire_row
;
unpack_entire_row
=
old_unpack_entire_row
;
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
int
ha_tokudb
::
prelock_range
(
const
key_range
*
start_key
,
const
key_range
*
end_key
)
{
int
ha_tokudb
::
prelock_range
(
const
key_range
*
start_key
,
const
key_range
*
end_key
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::prelock_range
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
THD
*
thd
=
ha_thd
();
THD
*
thd
=
ha_thd
();
int
error
=
0
;
int
error
=
0
;
...
@@ -5721,7 +5722,7 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k
...
@@ -5721,7 +5722,7 @@ int ha_tokudb::prelock_range( const key_range *start_key, const key_range *end_k
rows_fetched_using_bulk_fetch
=
0
;
rows_fetched_using_bulk_fetch
=
0
;
cleanup:
cleanup:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -5755,13 +5756,13 @@ cleanup:
...
@@ -5755,13 +5756,13 @@ cleanup:
int
ha_tokudb
::
read_range_next
()
int
ha_tokudb
::
read_range_next
()
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::read_range_next
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
error
=
handler
::
read_range_next
();
error
=
handler
::
read_range_next
();
if
(
error
)
{
if
(
error
)
{
range_lock_grabbed
=
false
;
range_lock_grabbed
=
false
;
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -5788,7 +5789,7 @@ int ha_tokudb::read_range_next()
...
@@ -5788,7 +5789,7 @@ int ha_tokudb::read_range_next()
nothing
nothing
*/
*/
void
ha_tokudb
::
position
(
const
uchar
*
record
)
{
void
ha_tokudb
::
position
(
const
uchar
*
record
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::position
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
key
;
DBT
key
;
if
(
hidden_primary_key
)
{
if
(
hidden_primary_key
)
{
DBUG_ASSERT
(
ref_length
==
(
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
+
sizeof
(
uint32_t
)));
DBUG_ASSERT
(
ref_length
==
(
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
+
sizeof
(
uint32_t
)));
...
@@ -5816,7 +5817,7 @@ void ha_tokudb::position(const uchar * record) {
...
@@ -5816,7 +5817,7 @@ void ha_tokudb::position(const uchar * record) {
// 0, always success
// 0, always success
//
//
int
ha_tokudb
::
info
(
uint
flag
)
{
int
ha_tokudb
::
info
(
uint
flag
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::info %p %d %lld"
,
this
,
flag
,
(
long
long
)
share
->
rows
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%d %lld"
,
flag
,
(
long
long
)
share
->
rows
);
int
error
;
int
error
;
DB_TXN
*
txn
=
NULL
;
DB_TXN
*
txn
=
NULL
;
uint
curr_num_DBs
=
table
->
s
->
keys
+
tokudb_test
(
hidden_primary_key
);
uint
curr_num_DBs
=
table
->
s
->
keys
+
tokudb_test
(
hidden_primary_key
);
...
@@ -5946,14 +5947,14 @@ cleanup:
...
@@ -5946,14 +5947,14 @@ cleanup:
commit_txn
(
txn
,
DB_TXN_NOSYNC
);
commit_txn
(
txn
,
DB_TXN_NOSYNC
);
txn
=
NULL
;
txn
=
NULL
;
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
// Per InnoDB: Tells something additional to the handler about how to do things.
// Per InnoDB: Tells something additional to the handler about how to do things.
//
//
int
ha_tokudb
::
extra
(
enum
ha_extra_function
operation
)
{
int
ha_tokudb
::
extra
(
enum
ha_extra_function
operation
)
{
TOKUDB_
DBUG_ENTER
(
"extra %p %d"
,
this
,
operation
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%d"
,
operation
);
switch
(
operation
)
{
switch
(
operation
)
{
case
HA_EXTRA_RESET_STATE
:
case
HA_EXTRA_RESET_STATE
:
reset
();
reset
();
...
@@ -5979,17 +5980,17 @@ int ha_tokudb::extra(enum ha_extra_function operation) {
...
@@ -5979,17 +5980,17 @@ int ha_tokudb::extra(enum ha_extra_function operation) {
default:
default:
break
;
break
;
}
}
TOKUDB_DBUG_RETURN
(
0
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
0
);
}
}
int
ha_tokudb
::
reset
(
void
)
{
int
ha_tokudb
::
reset
(
void
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::reset
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
key_read
=
false
;
key_read
=
false
;
using_ignore
=
false
;
using_ignore
=
false
;
using_ignore_no_key
=
false
;
using_ignore_no_key
=
false
;
reset_dsmrr
();
reset_dsmrr
();
invalidate_icp
();
invalidate_icp
();
TOKUDB_DBUG_RETURN
(
0
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
0
);
}
}
...
@@ -6013,16 +6014,16 @@ int ha_tokudb::acquire_table_lock (DB_TXN* trans, TABLE_LOCK_TYPE lt) {
...
@@ -6013,16 +6014,16 @@ int ha_tokudb::acquire_table_lock (DB_TXN* trans, TABLE_LOCK_TYPE lt) {
}
}
else
if
(
lt
==
lock_write
)
{
else
if
(
lt
==
lock_write
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
TOKUDB_TRACE
(
"%s
\n
"
,
__FUNCTION__
);
TOKUDB_TRACE
(
"%s"
,
__FUNCTION__
);
for
(
uint
i
=
0
;
i
<
curr_num_DBs
;
i
++
)
{
for
(
uint
i
=
0
;
i
<
curr_num_DBs
;
i
++
)
{
DB
*
db
=
share
->
key_file
[
i
];
DB
*
db
=
share
->
key_file
[
i
];
error
=
db
->
pre_acquire_table_lock
(
db
,
trans
);
error
=
db
->
pre_acquire_table_lock
(
db
,
trans
);
if
(
error
==
EINVAL
)
if
(
error
==
EINVAL
)
TOKUDB_TRACE
(
"%s %d db=%p trans=%p
\n
"
,
__FUNCTION__
,
i
,
db
,
trans
);
TOKUDB_TRACE
(
"%s %d db=%p trans=%p"
,
__FUNCTION__
,
i
,
db
,
trans
);
if
(
error
)
break
;
if
(
error
)
break
;
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
TOKUDB_TRACE
(
"%s error=%d
\n
"
,
__FUNCTION__
,
error
);
TOKUDB_TRACE
(
"%s error=%d"
,
__FUNCTION__
,
error
);
if
(
error
)
goto
cleanup
;
if
(
error
)
goto
cleanup
;
}
}
else
{
else
{
...
@@ -6065,7 +6066,7 @@ int ha_tokudb::create_txn(THD* thd, tokudb_trx_data* trx) {
...
@@ -6065,7 +6066,7 @@ int ha_tokudb::create_txn(THD* thd, tokudb_trx_data* trx) {
goto
cleanup
;
goto
cleanup
;
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"just created master %p
\n
"
,
trx
->
all
);
TOKUDB_TRACE
(
"just created master %p"
,
trx
->
all
);
}
}
trx
->
sp_level
=
trx
->
all
;
trx
->
sp_level
=
trx
->
all
;
trans_register_ha
(
thd
,
true
,
tokudb_hton
);
trans_register_ha
(
thd
,
true
,
tokudb_hton
);
...
@@ -6073,7 +6074,7 @@ int ha_tokudb::create_txn(THD* thd, tokudb_trx_data* trx) {
...
@@ -6073,7 +6074,7 @@ int ha_tokudb::create_txn(THD* thd, tokudb_trx_data* trx) {
DBUG_PRINT
(
"trans"
,
(
"starting transaction stmt"
));
DBUG_PRINT
(
"trans"
,
(
"starting transaction stmt"
));
if
(
trx
->
stmt
)
{
if
(
trx
->
stmt
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"warning:stmt=%p
\n
"
,
trx
->
stmt
);
TOKUDB_TRACE
(
"warning:stmt=%p"
,
trx
->
stmt
);
}
}
}
}
uint32_t
txn_begin_flags
;
uint32_t
txn_begin_flags
;
...
@@ -6103,7 +6104,7 @@ int ha_tokudb::create_txn(THD* thd, tokudb_trx_data* trx) {
...
@@ -6103,7 +6104,7 @@ int ha_tokudb::create_txn(THD* thd, tokudb_trx_data* trx) {
}
}
trx
->
sub_sp_level
=
trx
->
stmt
;
trx
->
sub_sp_level
=
trx
->
stmt
;
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"just created stmt %p %p
\n
"
,
trx
->
sp_level
,
trx
->
stmt
);
TOKUDB_TRACE
(
"just created stmt %p %p"
,
trx
->
sp_level
,
trx
->
stmt
);
}
}
reset_stmt_progress
(
&
trx
->
stmt_progress
);
reset_stmt_progress
(
&
trx
->
stmt_progress
);
trans_register_ha
(
thd
,
false
,
tokudb_hton
);
trans_register_ha
(
thd
,
false
,
tokudb_hton
);
...
@@ -6129,9 +6130,9 @@ cleanup:
...
@@ -6129,9 +6130,9 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
external_lock
(
THD
*
thd
,
int
lock_type
)
{
int
ha_tokudb
::
external_lock
(
THD
*
thd
,
int
lock_type
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::external_lock
cmd=%d %d"
,
thd_sql_command
(
thd
),
lock_type
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
cmd=%d %d"
,
thd_sql_command
(
thd
),
lock_type
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
TOKUDB_TRACE
(
"%s cmd=%d %d
\n
"
,
__FUNCTION__
,
thd_sql_command
(
thd
),
lock_type
);
TOKUDB_TRACE
(
"%s cmd=%d %d"
,
__FUNCTION__
,
thd_sql_command
(
thd
),
lock_type
);
int
error
=
0
;
int
error
=
0
;
tokudb_trx_data
*
trx
=
NULL
;
tokudb_trx_data
*
trx
=
NULL
;
...
@@ -6185,7 +6186,7 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
...
@@ -6185,7 +6186,7 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
if
(
!
is_fast_alter_running
)
{
if
(
!
is_fast_alter_running
)
{
commit_txn
(
trx
->
stmt
,
0
);
commit_txn
(
trx
->
stmt
,
0
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"commit:%p:%d
\n
"
,
trx
->
stmt
,
error
);
TOKUDB_TRACE
(
"commit:%p:%d"
,
trx
->
stmt
,
error
);
}
}
trx
->
stmt
=
NULL
;
trx
->
stmt
=
NULL
;
trx
->
sub_sp_level
=
NULL
;
trx
->
sub_sp_level
=
NULL
;
...
@@ -6197,8 +6198,8 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
...
@@ -6197,8 +6198,8 @@ int ha_tokudb::external_lock(THD * thd, int lock_type) {
}
}
cleanup:
cleanup:
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
TOKUDB_TRACE
(
"%s error=%d
\n
"
,
__FUNCTION__
,
error
);
TOKUDB_TRACE
(
"%s error=%d"
,
__FUNCTION__
,
error
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -6209,7 +6210,7 @@ cleanup:
...
@@ -6209,7 +6210,7 @@ cleanup:
*/
*/
int
ha_tokudb
::
start_stmt
(
THD
*
thd
,
thr_lock_type
lock_type
)
{
int
ha_tokudb
::
start_stmt
(
THD
*
thd
,
thr_lock_type
lock_type
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::start_stmt
cmd=%d %d"
,
thd_sql_command
(
thd
),
lock_type
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
cmd=%d %d"
,
thd_sql_command
(
thd
),
lock_type
);
int
error
=
0
;
int
error
=
0
;
...
@@ -6228,7 +6229,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
...
@@ -6228,7 +6229,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
}
}
else
{
else
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"trx->stmt already existed
\n
"
);
TOKUDB_TRACE
(
"trx->stmt already existed"
);
}
}
}
}
//
//
...
@@ -6258,7 +6259,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
...
@@ -6258,7 +6259,7 @@ int ha_tokudb::start_stmt(THD * thd, thr_lock_type lock_type) {
transaction
=
trx
->
sub_sp_level
;
transaction
=
trx
->
sub_sp_level
;
trans_register_ha
(
thd
,
false
,
tokudb_hton
);
trans_register_ha
(
thd
,
false
,
tokudb_hton
);
cleanup:
cleanup:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -6325,9 +6326,9 @@ uint32_t ha_tokudb::get_cursor_isolation_flags(enum thr_lock_type lock_type, THD
...
@@ -6325,9 +6326,9 @@ uint32_t ha_tokudb::get_cursor_isolation_flags(enum thr_lock_type lock_type, THD
*/
*/
THR_LOCK_DATA
**
ha_tokudb
::
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
)
{
THR_LOCK_DATA
**
ha_tokudb
::
store_lock
(
THD
*
thd
,
THR_LOCK_DATA
**
to
,
enum
thr_lock_type
lock_type
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::store_lock,
lock_type=%d cmd=%d"
,
lock_type
,
thd_sql_command
(
thd
));
TOKUDB_
HANDLER_DBUG_ENTER
(
"
lock_type=%d cmd=%d"
,
lock_type
,
thd_sql_command
(
thd
));
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
{
TOKUDB_TRACE
(
"%s lock_type=%d cmd=%d
\n
"
,
__FUNCTION__
,
lock_type
,
thd_sql_command
(
thd
));
TOKUDB_TRACE
(
"%s lock_type=%d cmd=%d"
,
__FUNCTION__
,
lock_type
,
thd_sql_command
(
thd
));
}
}
if
(
lock_type
!=
TL_IGNORE
&&
lock
.
type
==
TL_UNLOCK
)
{
if
(
lock_type
!=
TL_IGNORE
&&
lock
.
type
==
TL_UNLOCK
)
{
...
@@ -6362,7 +6363,7 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
...
@@ -6362,7 +6363,7 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
}
}
*
to
++
=
&
lock
;
*
to
++
=
&
lock
;
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_LOCK
)
TOKUDB_TRACE
(
"%s lock_type=%d
\n
"
,
__FUNCTION__
,
lock_type
);
TOKUDB_TRACE
(
"%s lock_type=%d"
,
__FUNCTION__
,
lock_type
);
DBUG_RETURN
(
to
);
DBUG_RETURN
(
to
);
}
}
...
@@ -6440,7 +6441,7 @@ static int create_sub_table(
...
@@ -6440,7 +6441,7 @@ static int create_sub_table(
bool
is_hot_index
bool
is_hot_index
)
)
{
{
TOKUDB_DBUG_ENTER
(
"
create_sub_table
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
DB
*
file
=
NULL
;
DB
*
file
=
NULL
;
uint32_t
create_flags
;
uint32_t
create_flags
;
...
@@ -6583,16 +6584,16 @@ void ha_tokudb::trace_create_table_info(const char *name, TABLE * form) {
...
@@ -6583,16 +6584,16 @@ void ha_tokudb::trace_create_table_info(const char *name, TABLE * form) {
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
{
for
(
i
=
0
;
i
<
form
->
s
->
fields
;
i
++
)
{
for
(
i
=
0
;
i
<
form
->
s
->
fields
;
i
++
)
{
Field
*
field
=
form
->
s
->
field
[
i
];
Field
*
field
=
form
->
s
->
field
[
i
];
TOKUDB_TRACE
(
"field:%d:%s:type=%d:flags=%x
\n
"
,
i
,
field
->
field_name
,
field
->
type
(),
field
->
flags
);
TOKUDB_TRACE
(
"field:%d:%s:type=%d:flags=%x"
,
i
,
field
->
field_name
,
field
->
type
(),
field
->
flags
);
}
}
for
(
i
=
0
;
i
<
form
->
s
->
keys
;
i
++
)
{
for
(
i
=
0
;
i
<
form
->
s
->
keys
;
i
++
)
{
KEY
*
key
=
&
form
->
s
->
key_info
[
i
];
KEY
*
key
=
&
form
->
s
->
key_info
[
i
];
TOKUDB_TRACE
(
"key:%d:%s:%d
\n
"
,
i
,
key
->
name
,
get_key_parts
(
key
));
TOKUDB_TRACE
(
"key:%d:%s:%d"
,
i
,
key
->
name
,
get_key_parts
(
key
));
uint
p
;
uint
p
;
for
(
p
=
0
;
p
<
get_key_parts
(
key
);
p
++
)
{
for
(
p
=
0
;
p
<
get_key_parts
(
key
);
p
++
)
{
KEY_PART_INFO
*
key_part
=
&
key
->
key_part
[
p
];
KEY_PART_INFO
*
key_part
=
&
key
->
key_part
[
p
];
Field
*
field
=
key_part
->
field
;
Field
*
field
=
key_part
->
field
;
TOKUDB_TRACE
(
"key:%d:%d:length=%d:%s:type=%d:flags=%x
\n
"
,
TOKUDB_TRACE
(
"key:%d:%d:length=%d:%s:type=%d:flags=%x"
,
i
,
p
,
key_part
->
length
,
field
->
field_name
,
field
->
type
(),
field
->
flags
);
i
,
p
,
key_part
->
length
,
field
->
field_name
,
field
->
type
(),
field
->
flags
);
}
}
}
}
...
@@ -6846,7 +6847,7 @@ static inline enum row_type row_format_to_row_type(srv_row_format_t row_format)
...
@@ -6846,7 +6847,7 @@ static inline enum row_type row_format_to_row_type(srv_row_format_t row_format)
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
)
{
int
ha_tokudb
::
create
(
const
char
*
name
,
TABLE
*
form
,
HA_CREATE_INFO
*
create_info
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::create %p %s"
,
this
,
name
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%s"
,
name
);
int
error
;
int
error
;
DB
*
status_block
=
NULL
;
DB
*
status_block
=
NULL
;
...
@@ -6985,7 +6986,7 @@ cleanup:
...
@@ -6985,7 +6986,7 @@ cleanup:
}
}
}
}
tokudb_my_free
(
newname
);
tokudb_my_free
(
newname
);
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
int
ha_tokudb
::
discard_or_import_tablespace
(
my_bool
discard
)
{
int
ha_tokudb
::
discard_or_import_tablespace
(
my_bool
discard
)
{
...
@@ -7172,7 +7173,7 @@ cleanup:
...
@@ -7172,7 +7173,7 @@ cleanup:
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
delete_table
(
const
char
*
name
)
{
int
ha_tokudb
::
delete_table
(
const
char
*
name
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::delete_table
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
error
=
delete_or_rename_table
(
name
,
NULL
,
true
);
error
=
delete_or_rename_table
(
name
,
NULL
,
true
);
if
(
error
==
DB_LOCK_NOTGRANTED
&&
((
tokudb_debug
&
TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS
)
==
0
))
{
if
(
error
==
DB_LOCK_NOTGRANTED
&&
((
tokudb_debug
&
TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS
)
==
0
))
{
...
@@ -7180,7 +7181,7 @@ int ha_tokudb::delete_table(const char *name) {
...
@@ -7180,7 +7181,7 @@ int ha_tokudb::delete_table(const char *name) {
another transaction has accessed the table. \
another transaction has accessed the table. \
To drop the table, make sure no transactions touch the table."
,
name
);
To drop the table, make sure no transactions touch the table."
,
name
);
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -7194,7 +7195,7 @@ To drop the table, make sure no transactions touch the table.", name);
...
@@ -7194,7 +7195,7 @@ To drop the table, make sure no transactions touch the table.", name);
// error otherwise
// error otherwise
//
//
int
ha_tokudb
::
rename_table
(
const
char
*
from
,
const
char
*
to
)
{
int
ha_tokudb
::
rename_table
(
const
char
*
from
,
const
char
*
to
)
{
TOKUDB_
DBUG_ENTER
(
"%s %s %s"
,
__FUNCTION__
,
from
,
to
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"%s %s"
,
from
,
to
);
int
error
;
int
error
;
error
=
delete_or_rename_table
(
from
,
to
,
false
);
error
=
delete_or_rename_table
(
from
,
to
,
false
);
if
(
error
==
DB_LOCK_NOTGRANTED
&&
((
tokudb_debug
&
TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS
)
==
0
))
{
if
(
error
==
DB_LOCK_NOTGRANTED
&&
((
tokudb_debug
&
TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS
)
==
0
))
{
...
@@ -7202,7 +7203,7 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
...
@@ -7202,7 +7203,7 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
another transaction has accessed the table. \
another transaction has accessed the table. \
To rename the table, make sure no transactions touch the table."
,
from
,
to
);
To rename the table, make sure no transactions touch the table."
,
from
,
to
);
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
...
@@ -7213,14 +7214,14 @@ To rename the table, make sure no transactions touch the table.", from, to);
...
@@ -7213,14 +7214,14 @@ To rename the table, make sure no transactions touch the table.", from, to);
*/
*/
/// QQQ why divide by 3
/// QQQ why divide by 3
double
ha_tokudb
::
scan_time
()
{
double
ha_tokudb
::
scan_time
()
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::scan_time
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
double
ret_val
=
(
double
)
stats
.
records
/
3
;
double
ret_val
=
(
double
)
stats
.
records
/
3
;
DBUG_RETURN
(
ret_val
);
DBUG_RETURN
(
ret_val
);
}
}
double
ha_tokudb
::
keyread_time
(
uint
index
,
uint
ranges
,
ha_rows
rows
)
double
ha_tokudb
::
keyread_time
(
uint
index
,
uint
ranges
,
ha_rows
rows
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::keyread_time
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
double
ret_val
;
double
ret_val
;
if
(
index
==
primary_key
||
key_is_clustering
(
&
table
->
key_info
[
index
]))
{
if
(
index
==
primary_key
||
key_is_clustering
(
&
table
->
key_info
[
index
]))
{
ret_val
=
read_time
(
index
,
ranges
,
rows
);
ret_val
=
read_time
(
index
,
ranges
,
rows
);
...
@@ -7258,7 +7259,7 @@ double ha_tokudb::read_time(
...
@@ -7258,7 +7259,7 @@ double ha_tokudb::read_time(
ha_rows
rows
ha_rows
rows
)
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::read_time
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
double
total_scan
;
double
total_scan
;
double
ret_val
;
double
ret_val
;
bool
is_primary
=
(
index
==
primary_key
);
bool
is_primary
=
(
index
==
primary_key
);
...
@@ -7304,7 +7305,7 @@ cleanup:
...
@@ -7304,7 +7305,7 @@ cleanup:
}
}
double
ha_tokudb
::
index_only_read_time
(
uint
keynr
,
double
records
)
{
double
ha_tokudb
::
index_only_read_time
(
uint
keynr
,
double
records
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::index_only_read_time
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
double
ret_val
=
keyread_time
(
keynr
,
1
,
(
ha_rows
)
records
);
double
ret_val
=
keyread_time
(
keynr
,
1
,
(
ha_rows
)
records
);
DBUG_RETURN
(
ret_val
);
DBUG_RETURN
(
ret_val
);
}
}
...
@@ -7323,7 +7324,7 @@ double ha_tokudb::index_only_read_time(uint keynr, double records) {
...
@@ -7323,7 +7324,7 @@ double ha_tokudb::index_only_read_time(uint keynr, double records) {
// HA_POS_ERROR - Something is wrong with the index tree
// HA_POS_ERROR - Something is wrong with the index tree
//
//
ha_rows
ha_tokudb
::
records_in_range
(
uint
keynr
,
key_range
*
start_key
,
key_range
*
end_key
)
{
ha_rows
ha_tokudb
::
records_in_range
(
uint
keynr
,
key_range
*
start_key
,
key_range
*
end_key
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::records_in_range
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
DBT
*
pleft_key
=
NULL
,
*
pright_key
=
NULL
;
DBT
*
pleft_key
=
NULL
,
*
pright_key
=
NULL
;
DBT
left_key
,
right_key
;
DBT
left_key
,
right_key
;
ha_rows
ret_val
=
HA_TOKUDB_RANGE_COUNT
;
ha_rows
ret_val
=
HA_TOKUDB_RANGE_COUNT
;
...
@@ -7456,12 +7457,12 @@ void ha_tokudb::init_auto_increment() {
...
@@ -7456,12 +7457,12 @@ void ha_tokudb::init_auto_increment() {
commit_txn
(
txn
,
0
);
commit_txn
(
txn
,
0
);
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_AUTO_INCREMENT
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_AUTO_INCREMENT
)
{
TOKUDB_TRACE
(
"init auto increment:%lld
\n
"
,
share
->
last_auto_increment
);
TOKUDB_TRACE
(
"init auto increment:%lld"
,
share
->
last_auto_increment
);
}
}
}
}
void
ha_tokudb
::
get_auto_increment
(
ulonglong
offset
,
ulonglong
increment
,
ulonglong
nb_desired_values
,
ulonglong
*
first_value
,
ulonglong
*
nb_reserved_values
)
{
void
ha_tokudb
::
get_auto_increment
(
ulonglong
offset
,
ulonglong
increment
,
ulonglong
nb_desired_values
,
ulonglong
*
first_value
,
ulonglong
*
nb_reserved_values
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::get_auto_increment
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
ulonglong
nr
;
ulonglong
nr
;
bool
over
;
bool
over
;
...
@@ -7489,7 +7490,7 @@ void ha_tokudb::get_auto_increment(ulonglong offset, ulonglong increment, ulongl
...
@@ -7489,7 +7490,7 @@ void ha_tokudb::get_auto_increment(ulonglong offset, ulonglong increment, ulongl
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_AUTO_INCREMENT
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_AUTO_INCREMENT
)
{
TOKUDB_TRACE
(
"get_auto_increment(%lld,%lld,%lld):got:%lld:%lld
\n
"
,
TOKUDB_TRACE
(
"get_auto_increment(%lld,%lld,%lld):got:%lld:%lld"
,
offset
,
increment
,
nb_desired_values
,
nr
,
nb_desired_values
);
offset
,
increment
,
nb_desired_values
,
nr
,
nb_desired_values
);
}
}
*
first_value
=
nr
;
*
first_value
=
nr
;
...
@@ -7531,7 +7532,7 @@ int ha_tokudb::tokudb_add_index(
...
@@ -7531,7 +7532,7 @@ int ha_tokudb::tokudb_add_index(
bool
*
modified_DBs
bool
*
modified_DBs
)
)
{
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::tokudb_add_index
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
assert
(
txn
);
assert
(
txn
);
int
error
;
int
error
;
...
@@ -7897,7 +7898,7 @@ cleanup:
...
@@ -7897,7 +7898,7 @@ cleanup:
another transaction has accessed the table. \
another transaction has accessed the table. \
To add indexes, make sure no transactions touch the table."
,
share
->
table_name
);
To add indexes, make sure no transactions touch the table."
,
share
->
table_name
);
}
}
TOKUDB_DBUG_RETURN
(
error
?
error
:
loader_error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
?
error
:
loader_error
);
}
}
//
//
...
@@ -7943,7 +7944,7 @@ void ha_tokudb::restore_add_index(TABLE* table_arg, uint num_of_keys, bool incre
...
@@ -7943,7 +7944,7 @@ void ha_tokudb::restore_add_index(TABLE* table_arg, uint num_of_keys, bool incre
// With a transaction, drops dictionaries associated with indexes in key_num
// With a transaction, drops dictionaries associated with indexes in key_num
//
//
int
ha_tokudb
::
drop_indexes
(
TABLE
*
table_arg
,
uint
*
key_num
,
uint
num_of_keys
,
KEY
*
key_info
,
DB_TXN
*
txn
)
{
int
ha_tokudb
::
drop_indexes
(
TABLE
*
table_arg
,
uint
*
key_num
,
uint
num_of_keys
,
KEY
*
key_info
,
DB_TXN
*
txn
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::drop_indexes
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
assert
(
txn
);
assert
(
txn
);
int
error
=
0
;
int
error
=
0
;
...
@@ -7973,7 +7974,7 @@ cleanup:
...
@@ -7973,7 +7974,7 @@ cleanup:
another transaction has accessed the table. \
another transaction has accessed the table. \
To drop indexes, make sure no transactions touch the table."
,
share
->
table_name
);
To drop indexes, make sure no transactions touch the table."
,
share
->
table_name
);
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
//
//
...
@@ -8085,9 +8086,9 @@ cleanup:
...
@@ -8085,9 +8086,9 @@ cleanup:
// for 5.5
// for 5.5
int
ha_tokudb
::
truncate
()
{
int
ha_tokudb
::
truncate
()
{
TOKUDB_
DBUG_ENTER
(
"truncate
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
delete_all_rows_internal
();
int
error
=
delete_all_rows_internal
();
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
// delete all rows from a table
// delete all rows from a table
...
@@ -8099,7 +8100,7 @@ int ha_tokudb::truncate() {
...
@@ -8099,7 +8100,7 @@ int ha_tokudb::truncate() {
// issues go away.
// issues go away.
// returns: 0 if success
// returns: 0 if success
int
ha_tokudb
::
delete_all_rows
()
{
int
ha_tokudb
::
delete_all_rows
()
{
TOKUDB_
DBUG_ENTER
(
"delete_all_rows
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
if
(
thd_sql_command
(
ha_thd
())
!=
SQLCOM_TRUNCATE
)
{
if
(
thd_sql_command
(
ha_thd
())
!=
SQLCOM_TRUNCATE
)
{
share
->
try_table_lock
=
true
;
share
->
try_table_lock
=
true
;
...
@@ -8107,11 +8108,11 @@ int ha_tokudb::delete_all_rows() {
...
@@ -8107,11 +8108,11 @@ int ha_tokudb::delete_all_rows() {
}
}
if
(
error
==
0
)
if
(
error
==
0
)
error
=
delete_all_rows_internal
();
error
=
delete_all_rows_internal
();
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
int
ha_tokudb
::
delete_all_rows_internal
()
{
int
ha_tokudb
::
delete_all_rows_internal
()
{
TOKUDB_
DBUG_ENTER
(
"delete_all_rows_internal
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
uint
curr_num_DBs
=
0
;
uint
curr_num_DBs
=
0
;
DB_TXN
*
txn
=
NULL
;
DB_TXN
*
txn
=
NULL
;
...
@@ -8194,7 +8195,7 @@ cleanup:
...
@@ -8194,7 +8195,7 @@ cleanup:
}
}
}
}
}
}
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
void
ha_tokudb
::
set_loader_error
(
int
err
)
{
void
ha_tokudb
::
set_loader_error
(
int
err
)
{
...
...
storage/tokudb/ha_tokudb_admin.cc
View file @
c7836bb3
...
@@ -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_
DBUG_ENTER
(
"ha_tokudb::analyze
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
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
;
...
@@ -165,7 +165,7 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
...
@@ -165,7 +165,7 @@ int ha_tokudb::analyze(THD *thd, HA_CHECK_OPT *check_opt) {
}
}
if
(
result
==
HA_ADMIN_OK
)
if
(
result
==
HA_ADMIN_OK
)
tokudb
::
set_card_in_status
(
share
->
status_block
,
txn
,
table_share
->
key_parts
,
rec_per_key
);
tokudb
::
set_card_in_status
(
share
->
status_block
,
txn
,
table_share
->
key_parts
,
rec_per_key
);
TOKUDB_DBUG_RETURN
(
result
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
result
);
}
}
static
int
hot_poll_fun
(
void
*
extra
,
float
progress
)
{
static
int
hot_poll_fun
(
void
*
extra
,
float
progress
)
{
...
@@ -192,7 +192,7 @@ static int hot_poll_fun(void *extra, float progress) {
...
@@ -192,7 +192,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_
DBUG_ENTER
(
"ha_tokudb::optimize
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
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
);
...
@@ -233,7 +233,7 @@ cleanup:
...
@@ -233,7 +233,7 @@ cleanup:
thd_progress_end
(
thd
);
thd_progress_end
(
thd
);
#endif
#endif
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
struct
check_context
{
struct
check_context
{
...
@@ -262,7 +262,7 @@ static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) {
...
@@ -262,7 +262,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_
DBUG_ENTER
(
"check
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
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"
);
...
@@ -319,5 +319,5 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
...
@@ -319,5 +319,5 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
}
}
}
}
thd_proc_info
(
thd
,
old_proc_info
);
thd_proc_info
(
thd
,
old_proc_info
);
TOKUDB_DBUG_RETURN
(
result
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
result
);
}
}
storage/tokudb/ha_tokudb_alter_56.cc
View file @
c7836bb3
...
@@ -282,7 +282,7 @@ static bool only_flags(ulong bits, ulong mask) {
...
@@ -282,7 +282,7 @@ static bool only_flags(ulong bits, ulong mask) {
// must set WRITE_ALLOW_WRITE lock type in the external lock method to avoid deadlocks
// must set WRITE_ALLOW_WRITE lock type in the external lock method to avoid deadlocks
// with the MDL lock and the table lock
// with the MDL lock and the table lock
enum_alter_inplace_result
ha_tokudb
::
check_if_supported_inplace_alter
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
enum_alter_inplace_result
ha_tokudb
::
check_if_supported_inplace_alter
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
TOKUDB_
DBUG_ENTER
(
"check_if_supported_alter
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_ALTER_TABLE_INFO
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_ALTER_TABLE_INFO
)
{
print_alter_info
(
altered_table
,
ha_alter_info
);
print_alter_info
(
altered_table
,
ha_alter_info
);
...
@@ -437,7 +437,7 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt
...
@@ -437,7 +437,7 @@ enum_alter_inplace_result ha_tokudb::check_if_supported_inplace_alter(TABLE *alt
// Prepare for the alter operations
// Prepare for the alter operations
bool
ha_tokudb
::
prepare_inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
bool
ha_tokudb
::
prepare_inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
TOKUDB_
DBUG_ENTER
(
"prepare_inplace_alter_table
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
assert
(
transaction
);
// transaction must exist after table is locked
assert
(
transaction
);
// transaction must exist after table is locked
ctx
->
alter_txn
=
transaction
;
ctx
->
alter_txn
=
transaction
;
...
@@ -447,7 +447,7 @@ bool ha_tokudb::prepare_inplace_alter_table(TABLE *altered_table, Alter_inplace_
...
@@ -447,7 +447,7 @@ bool ha_tokudb::prepare_inplace_alter_table(TABLE *altered_table, Alter_inplace_
// Execute the alter operations.
// Execute the alter operations.
bool
ha_tokudb
::
inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
bool
ha_tokudb
::
inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
TOKUDB_
DBUG_ENTER
(
"inplace_alter_table
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
...
@@ -674,7 +674,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
...
@@ -674,7 +674,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
// If commit then write the new frm data to the status using the alter transaction.
// If commit then write the new frm data to the status using the alter transaction.
// If abort then abort the alter transaction and try to rollback the non-transactional changes.
// If abort then abort the alter transaction and try to rollback the non-transactional changes.
bool
ha_tokudb
::
commit_inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
,
bool
commit
)
{
bool
ha_tokudb
::
commit_inplace_alter_table
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
,
bool
commit
)
{
TOKUDB_
DBUG_ENTER
(
"commit_inplace_alter_table
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
bool
result
=
false
;
// success
bool
result
=
false
;
// success
...
...
storage/tokudb/ha_tokudb_update.cc
View file @
c7836bb3
...
@@ -252,7 +252,7 @@ static uint32_t blob_field_index(TABLE *table, KEY_AND_COL_INFO *kc_info, uint i
...
@@ -252,7 +252,7 @@ static uint32_t blob_field_index(TABLE *table, KEY_AND_COL_INFO *kc_info, uint i
// of where conditions (conds). The function returns 0 if the update is handled in the storage engine.
// of where conditions (conds). The function returns 0 if the update is handled in the storage engine.
// Otherwise, an error is returned.
// Otherwise, an error is returned.
int
ha_tokudb
::
fast_update
(
THD
*
thd
,
List
<
Item
>
&
update_fields
,
List
<
Item
>
&
update_values
,
Item
*
conds
)
{
int
ha_tokudb
::
fast_update
(
THD
*
thd
,
List
<
Item
>
&
update_fields
,
List
<
Item
>
&
update_values
,
Item
*
conds
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::fast_update
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
if
(
tokudb_debug
&
TOKUDB_DEBUG_UPSERT
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_UPSERT
)
{
...
@@ -287,7 +287,7 @@ check_error:
...
@@ -287,7 +287,7 @@ check_error:
}
}
return_error:
return_error:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
// Return true if an expression is a simple int expression or a simple function of +- int expression.
// Return true if an expression is a simple int expression or a simple function of +- int expression.
...
@@ -856,7 +856,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
...
@@ -856,7 +856,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
// An upsert consists of a row and a list of update expressions (update_fields[i] = update_values[i]).
// An upsert consists of a row and a list of update expressions (update_fields[i] = update_values[i]).
// The function returns 0 if the upsert is handled in the storage engine. Otherwise, an error code is returned.
// The function returns 0 if the upsert is handled in the storage engine. Otherwise, an error code is returned.
int
ha_tokudb
::
upsert
(
THD
*
thd
,
List
<
Item
>
&
update_fields
,
List
<
Item
>
&
update_values
)
{
int
ha_tokudb
::
upsert
(
THD
*
thd
,
List
<
Item
>
&
update_fields
,
List
<
Item
>
&
update_values
)
{
TOKUDB_
DBUG_ENTER
(
"ha_tokudb::upsert
"
);
TOKUDB_
HANDLER_DBUG_ENTER
(
"
"
);
int
error
=
0
;
int
error
=
0
;
...
@@ -890,7 +890,7 @@ check_error:
...
@@ -890,7 +890,7 @@ check_error:
}
}
return_error:
return_error:
TOKUDB_DBUG_RETURN
(
error
);
TOKUDB_
HANDLER_
DBUG_RETURN
(
error
);
}
}
// Check if an upsert can be handled by this storage engine. Return trus if it can.
// Check if an upsert can be handled by this storage engine. Return trus if it can.
...
...
storage/tokudb/hatoku_defines.h
View file @
c7836bb3
...
@@ -241,8 +241,7 @@ extern ulong tokudb_debug;
...
@@ -241,8 +241,7 @@ extern ulong tokudb_debug;
#define TOKUDB_DEBUG_ANALYZE (1<<15)
#define TOKUDB_DEBUG_ANALYZE (1<<15)
#define TOKUDB_TRACE(f, ...) \
#define TOKUDB_TRACE(f, ...) \
fprintf(stderr, "%d:%s:%d:" f, my_tid(), __FILE__, __LINE__, ##__VA_ARGS__);
fprintf(stderr, "%u %s:%u " f "\n", my_tid(), __FILE__, __LINE__, ##__VA_ARGS__);
static
inline
unsigned
int
my_tid
()
{
static
inline
unsigned
int
my_tid
()
{
return
(
unsigned
int
)
toku_os_gettid
();
return
(
unsigned
int
)
toku_os_gettid
();
...
@@ -251,17 +250,33 @@ static inline unsigned int my_tid() {
...
@@ -251,17 +250,33 @@ static inline unsigned int my_tid() {
#define TOKUDB_DBUG_ENTER(f, ...) \
#define TOKUDB_DBUG_ENTER(f, ...) \
{ \
{ \
if (tokudb_debug & TOKUDB_DEBUG_ENTER) { \
if (tokudb_debug & TOKUDB_DEBUG_ENTER) { \
TOKUDB_TRACE(
f "\n", ##__VA_ARGS__);
\
TOKUDB_TRACE(
"%s " f, __FUNCTION__, ##__VA_ARGS__);
\
} \
} \
} \
} \
DBUG_ENTER(__FUNCTION__);
DBUG_ENTER(__FUNCTION__);
#define TOKUDB_DBUG_RETURN(r) \
#define TOKUDB_DBUG_RETURN(r) \
{ \
{ \
int rr = (r); \
int rr = (r); \
if ((tokudb_debug & TOKUDB_DEBUG_RETURN) || (rr != 0 && (tokudb_debug & TOKUDB_DEBUG_ERROR))) { \
if ((tokudb_debug & TOKUDB_DEBUG_RETURN) || (rr != 0 && (tokudb_debug & TOKUDB_DEBUG_ERROR))) { \
TOKUDB_TRACE("%s:return %d\n", __FUNCTION__, rr); \
TOKUDB_TRACE("%s return %d", __FUNCTION__, rr); \
} \
DBUG_RETURN(rr); \
}
#define TOKUDB_HANDLER_DBUG_ENTER(f, ...) \
{ \
if (tokudb_debug & TOKUDB_DEBUG_ENTER) { \
fprintf(stderr, "%u %p %s:%u ha_tokudb::%s " f "\n", my_tid(), this, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \
} \
} \
DBUG_ENTER(__FUNCTION__);
#define TOKUDB_HANDLER_DBUG_RETURN(r) \
{ \
int rr = (r); \
if ((tokudb_debug & TOKUDB_DEBUG_RETURN) || (rr != 0 && (tokudb_debug & TOKUDB_DEBUG_ERROR))) { \
fprintf(stderr, "%u %p %s:%u ha_tokudb::%s return %d" "\n", my_tid(), this, __FILE__, __LINE__, __FUNCTION__, rr); \
} \
} \
DBUG_RETURN(rr); \
DBUG_RETURN(rr); \
}
}
...
@@ -353,14 +368,14 @@ static inline int txn_begin(DB_ENV *env, DB_TXN *parent, DB_TXN **txn, uint32_t
...
@@ -353,14 +368,14 @@ static inline int txn_begin(DB_ENV *env, DB_TXN *parent, DB_TXN **txn, uint32_t
this_txn
->
set_client_id
(
this_txn
,
thd_get_thread_id
(
thd
));
this_txn
->
set_client_id
(
this_txn
,
thd_get_thread_id
(
thd
));
}
}
if
((
tokudb_debug
&
TOKUDB_DEBUG_TXN
))
{
if
((
tokudb_debug
&
TOKUDB_DEBUG_TXN
))
{
TOKUDB_TRACE
(
"begin txn %p %p %u r=%d
\n
"
,
parent
,
*
txn
,
flags
,
r
);
TOKUDB_TRACE
(
"begin txn %p %p %u r=%d"
,
parent
,
*
txn
,
flags
,
r
);
}
}
return
r
;
return
r
;
}
}
static
inline
void
commit_txn
(
DB_TXN
*
txn
,
uint32_t
flags
)
{
static
inline
void
commit_txn
(
DB_TXN
*
txn
,
uint32_t
flags
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
TOKUDB_TRACE
(
"commit txn %p
\n
"
,
txn
);
TOKUDB_TRACE
(
"commit txn %p"
,
txn
);
int
r
=
txn
->
commit
(
txn
,
flags
);
int
r
=
txn
->
commit
(
txn
,
flags
);
if
(
r
!=
0
)
{
if
(
r
!=
0
)
{
sql_print_error
(
"tried committing transaction %p and got error code %d"
,
txn
,
r
);
sql_print_error
(
"tried committing transaction %p and got error code %d"
,
txn
,
r
);
...
@@ -370,7 +385,7 @@ static inline void commit_txn(DB_TXN* txn, uint32_t flags) {
...
@@ -370,7 +385,7 @@ static inline void commit_txn(DB_TXN* txn, uint32_t flags) {
static
inline
void
abort_txn
(
DB_TXN
*
txn
)
{
static
inline
void
abort_txn
(
DB_TXN
*
txn
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
TOKUDB_TRACE
(
"abort txn %p
\n
"
,
txn
);
TOKUDB_TRACE
(
"abort txn %p"
,
txn
);
int
r
=
txn
->
abort
(
txn
);
int
r
=
txn
->
abort
(
txn
);
if
(
r
!=
0
)
{
if
(
r
!=
0
)
{
sql_print_error
(
"tried aborting transaction %p and got error code %d"
,
txn
,
r
);
sql_print_error
(
"tried aborting transaction %p and got error code %d"
,
txn
,
r
);
...
...
storage/tokudb/hatoku_hton.cc
View file @
c7836bb3
...
@@ -292,7 +292,7 @@ static void handle_ydb_error(int error) {
...
@@ -292,7 +292,7 @@ static void handle_ydb_error(int error) {
}
}
static
int
tokudb_init_func
(
void
*
p
)
{
static
int
tokudb_init_func
(
void
*
p
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_init_func
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
r
;
int
r
;
#if defined(_WIN64)
#if defined(_WIN64)
...
@@ -381,7 +381,7 @@ static int tokudb_init_func(void *p) {
...
@@ -381,7 +381,7 @@ static int tokudb_init_func(void *p) {
r
=
db_env
->
set_flags
(
db_env
,
tokudb_env_flags
,
1
);
r
=
db_env
->
set_flags
(
db_env
,
tokudb_env_flags
,
1
);
if
(
r
)
{
// QQQ
if
(
r
)
{
// QQQ
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
TOKUDB_TRACE
(
"%s:WARNING: flags=%x r=%d
\n
"
,
__FUNCTION__
,
tokudb_env_flags
,
r
);
TOKUDB_TRACE
(
"%s:WARNING: flags=%x r=%d"
,
__FUNCTION__
,
tokudb_env_flags
,
r
);
// goto error;
// goto error;
}
}
...
@@ -454,15 +454,15 @@ static int tokudb_init_func(void *p) {
...
@@ -454,15 +454,15 @@ static int tokudb_init_func(void *p) {
r
=
db_env
->
get_cachesize
(
db_env
,
&
gbytes
,
&
bytes
,
&
parts
);
r
=
db_env
->
get_cachesize
(
db_env
,
&
gbytes
,
&
bytes
,
&
parts
);
if
(
r
==
0
)
if
(
r
==
0
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
TOKUDB_TRACE
(
"%s:tokudb_cache_size=%lld
\n
"
,
__FUNCTION__
,
((
unsigned
long
long
)
gbytes
<<
30
)
+
bytes
);
TOKUDB_TRACE
(
"%s:tokudb_cache_size=%lld"
,
__FUNCTION__
,
((
unsigned
long
long
)
gbytes
<<
30
)
+
bytes
);
if
(
db_env
->
set_redzone
)
{
if
(
db_env
->
set_redzone
)
{
r
=
db_env
->
set_redzone
(
db_env
,
tokudb_fs_reserve_percent
);
r
=
db_env
->
set_redzone
(
db_env
,
tokudb_fs_reserve_percent
);
if
(
r
&&
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
))
if
(
r
&&
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
))
TOKUDB_TRACE
(
"%s:%d r=%d
\n
"
,
__FUNCTION__
,
__LINE__
,
r
);
TOKUDB_TRACE
(
"%s:%d r=%d"
,
__FUNCTION__
,
__LINE__
,
r
);
}
}
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
TOKUDB_TRACE
(
"%s:env open:flags=%x
\n
"
,
__FUNCTION__
,
tokudb_init_flags
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
TOKUDB_TRACE
(
"%s:env open:flags=%x"
,
__FUNCTION__
,
tokudb_init_flags
);
r
=
db_env
->
set_generate_row_callback_for_put
(
db_env
,
generate_row_for_put
);
r
=
db_env
->
set_generate_row_callback_for_put
(
db_env
,
generate_row_for_put
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -476,10 +476,10 @@ static int tokudb_init_func(void *p) {
...
@@ -476,10 +476,10 @@ static int tokudb_init_func(void *p) {
r
=
db_env
->
open
(
db_env
,
tokudb_home
,
tokudb_init_flags
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
);
r
=
db_env
->
open
(
db_env
,
tokudb_home
,
tokudb_init_flags
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
TOKUDB_TRACE
(
"%s:env opened:return=%d
\n
"
,
__FUNCTION__
,
r
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_INIT
)
TOKUDB_TRACE
(
"%s:env opened:return=%d"
,
__FUNCTION__
,
r
);
if
(
r
)
{
if
(
r
)
{
DBUG_PRINT
(
"info"
,
(
"env->open %d
\n
"
,
r
));
DBUG_PRINT
(
"info"
,
(
"env->open %d"
,
r
));
goto
error
;
goto
error
;
}
}
...
@@ -523,7 +523,7 @@ error:
...
@@ -523,7 +523,7 @@ error:
}
}
static
int
tokudb_done_func
(
void
*
p
)
{
static
int
tokudb_done_func
(
void
*
p
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_done_func
"
);
TOKUDB_DBUG_ENTER
(
""
);
tokudb_my_free
(
toku_global_status_variables
);
tokudb_my_free
(
toku_global_status_variables
);
toku_global_status_variables
=
NULL
;
toku_global_status_variables
=
NULL
;
tokudb_my_free
(
toku_global_status_rows
);
tokudb_my_free
(
toku_global_status_rows
);
...
@@ -541,7 +541,7 @@ static handler *tokudb_create_handler(handlerton * hton, TABLE_SHARE * table, ME
...
@@ -541,7 +541,7 @@ static handler *tokudb_create_handler(handlerton * hton, TABLE_SHARE * table, ME
}
}
int
tokudb_end
(
handlerton
*
hton
,
ha_panic_function
type
)
{
int
tokudb_end
(
handlerton
*
hton
,
ha_panic_function
type
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_end
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
=
0
;
int
error
=
0
;
// 3938: if we finalize the storage engine plugin, it is no longer
// 3938: if we finalize the storage engine plugin, it is no longer
...
@@ -578,7 +578,7 @@ static int tokudb_close_connection(handlerton * hton, THD * thd) {
...
@@ -578,7 +578,7 @@ static int tokudb_close_connection(handlerton * hton, THD * thd) {
}
}
bool
tokudb_flush_logs
(
handlerton
*
hton
)
{
bool
tokudb_flush_logs
(
handlerton
*
hton
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_flush_logs
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
bool
result
=
0
;
bool
result
=
0
;
...
@@ -654,7 +654,7 @@ static void tokudb_cleanup_handlers(tokudb_trx_data *trx, DB_TXN *txn) {
...
@@ -654,7 +654,7 @@ static void tokudb_cleanup_handlers(tokudb_trx_data *trx, DB_TXN *txn) {
}
}
static
int
tokudb_commit
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
{
static
int
tokudb_commit
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_commit
"
);
TOKUDB_DBUG_ENTER
(
""
);
DBUG_PRINT
(
"trans"
,
(
"ending transaction %s"
,
all
?
"all"
:
"stmt"
));
DBUG_PRINT
(
"trans"
,
(
"ending transaction %s"
,
all
?
"all"
:
"stmt"
));
uint32_t
syncflag
=
THDVAR
(
thd
,
commit_sync
)
?
0
:
DB_TXN_NOSYNC
;
uint32_t
syncflag
=
THDVAR
(
thd
,
commit_sync
)
?
0
:
DB_TXN_NOSYNC
;
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
...
@@ -662,7 +662,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
...
@@ -662,7 +662,7 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
DB_TXN
*
this_txn
=
*
txn
;
DB_TXN
*
this_txn
=
*
txn
;
if
(
this_txn
)
{
if
(
this_txn
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"commit %u %p
\n
"
,
all
,
this_txn
);
TOKUDB_TRACE
(
"commit %u %p"
,
all
,
this_txn
);
}
}
// test hook to induce a crash on a debug build
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF
(
"tokudb_crash_commit_before"
,
DBUG_SUICIDE
(););
DBUG_EXECUTE_IF
(
"tokudb_crash_commit_before"
,
DBUG_SUICIDE
(););
...
@@ -677,21 +677,21 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
...
@@ -677,21 +677,21 @@ static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
trx
->
sub_sp_level
=
NULL
;
trx
->
sub_sp_level
=
NULL
;
}
}
else
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
else
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"nothing to commit %d
\n
"
,
all
);
TOKUDB_TRACE
(
"nothing to commit %d"
,
all
);
}
}
reset_stmt_progress
(
&
trx
->
stmt_progress
);
reset_stmt_progress
(
&
trx
->
stmt_progress
);
TOKUDB_DBUG_RETURN
(
0
);
TOKUDB_DBUG_RETURN
(
0
);
}
}
static
int
tokudb_rollback
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
{
static
int
tokudb_rollback
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_rollback
"
);
TOKUDB_DBUG_ENTER
(
""
);
DBUG_PRINT
(
"trans"
,
(
"aborting transaction %s"
,
all
?
"all"
:
"stmt"
));
DBUG_PRINT
(
"trans"
,
(
"aborting transaction %s"
,
all
?
"all"
:
"stmt"
));
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
DB_TXN
**
txn
=
all
?
&
trx
->
all
:
&
trx
->
stmt
;
DB_TXN
**
txn
=
all
?
&
trx
->
all
:
&
trx
->
stmt
;
DB_TXN
*
this_txn
=
*
txn
;
DB_TXN
*
this_txn
=
*
txn
;
if
(
this_txn
)
{
if
(
this_txn
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"rollback %u %p
\n
"
,
all
,
this_txn
);
TOKUDB_TRACE
(
"rollback %u %p"
,
all
,
this_txn
);
}
}
tokudb_cleanup_handlers
(
trx
,
this_txn
);
tokudb_cleanup_handlers
(
trx
,
this_txn
);
abort_txn_with_progress
(
this_txn
,
thd
);
abort_txn_with_progress
(
this_txn
,
thd
);
...
@@ -703,7 +703,7 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
...
@@ -703,7 +703,7 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
}
}
else
{
else
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"abort0
\n
"
);
TOKUDB_TRACE
(
"abort0"
);
}
}
}
}
reset_stmt_progress
(
&
trx
->
stmt_progress
);
reset_stmt_progress
(
&
trx
->
stmt_progress
);
...
@@ -713,14 +713,14 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
...
@@ -713,14 +713,14 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
#if TOKU_INCLUDE_XA
#if TOKU_INCLUDE_XA
static
int
tokudb_xa_prepare
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
{
static
int
tokudb_xa_prepare
(
handlerton
*
hton
,
THD
*
thd
,
bool
all
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_xa_prepare
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
r
=
0
;
int
r
=
0
;
DBUG_PRINT
(
"trans"
,
(
"preparing transaction %s"
,
all
?
"all"
:
"stmt"
));
DBUG_PRINT
(
"trans"
,
(
"preparing transaction %s"
,
all
?
"all"
:
"stmt"
));
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
DB_TXN
*
txn
=
all
?
trx
->
all
:
trx
->
stmt
;
DB_TXN
*
txn
=
all
?
trx
->
all
:
trx
->
stmt
;
if
(
txn
)
{
if
(
txn
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"doing txn prepare:%d:%p
\n
"
,
all
,
txn
);
TOKUDB_TRACE
(
"doing txn prepare:%d:%p"
,
all
,
txn
);
}
}
// a TOKU_XA_XID is identical to a MYSQL_XID
// a TOKU_XA_XID is identical to a MYSQL_XID
TOKU_XA_XID
thd_xid
;
TOKU_XA_XID
thd_xid
;
...
@@ -732,13 +732,13 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
...
@@ -732,13 +732,13 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
DBUG_EXECUTE_IF
(
"tokudb_crash_prepare_after"
,
DBUG_SUICIDE
(););
DBUG_EXECUTE_IF
(
"tokudb_crash_prepare_after"
,
DBUG_SUICIDE
(););
}
}
else
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
else
if
(
tokudb_debug
&
TOKUDB_DEBUG_TXN
)
{
TOKUDB_TRACE
(
"nothing to prepare %d
\n
"
,
all
);
TOKUDB_TRACE
(
"nothing to prepare %d"
,
all
);
}
}
TOKUDB_DBUG_RETURN
(
r
);
TOKUDB_DBUG_RETURN
(
r
);
}
}
static
int
tokudb_xa_recover
(
handlerton
*
hton
,
XID
*
xid_list
,
uint
len
)
{
static
int
tokudb_xa_recover
(
handlerton
*
hton
,
XID
*
xid_list
,
uint
len
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_xa_recover
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
r
=
0
;
int
r
=
0
;
if
(
len
==
0
||
xid_list
==
NULL
)
{
if
(
len
==
0
||
xid_list
==
NULL
)
{
TOKUDB_DBUG_RETURN
(
0
);
TOKUDB_DBUG_RETURN
(
0
);
...
@@ -756,7 +756,7 @@ static int tokudb_xa_recover(handlerton* hton, XID* xid_list, uint len) {
...
@@ -756,7 +756,7 @@ static int tokudb_xa_recover(handlerton* hton, XID* xid_list, uint len) {
}
}
static
int
tokudb_commit_by_xid
(
handlerton
*
hton
,
XID
*
xid
)
{
static
int
tokudb_commit_by_xid
(
handlerton
*
hton
,
XID
*
xid
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_commit_by_xid
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
r
=
0
;
int
r
=
0
;
DB_TXN
*
txn
=
NULL
;
DB_TXN
*
txn
=
NULL
;
TOKU_XA_XID
*
toku_xid
=
(
TOKU_XA_XID
*
)
xid
;
TOKU_XA_XID
*
toku_xid
=
(
TOKU_XA_XID
*
)
xid
;
...
@@ -773,7 +773,7 @@ cleanup:
...
@@ -773,7 +773,7 @@ cleanup:
}
}
static
int
tokudb_rollback_by_xid
(
handlerton
*
hton
,
XID
*
xid
)
{
static
int
tokudb_rollback_by_xid
(
handlerton
*
hton
,
XID
*
xid
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_rollback_by_xid
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
r
=
0
;
int
r
=
0
;
DB_TXN
*
txn
=
NULL
;
DB_TXN
*
txn
=
NULL
;
TOKU_XA_XID
*
toku_xid
=
(
TOKU_XA_XID
*
)
xid
;
TOKU_XA_XID
*
toku_xid
=
(
TOKU_XA_XID
*
)
xid
;
...
@@ -792,7 +792,7 @@ cleanup:
...
@@ -792,7 +792,7 @@ cleanup:
#endif
#endif
static
int
tokudb_savepoint
(
handlerton
*
hton
,
THD
*
thd
,
void
*
savepoint
)
{
static
int
tokudb_savepoint
(
handlerton
*
hton
,
THD
*
thd
,
void
*
savepoint
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_savepoint
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
SP_INFO
save_info
=
(
SP_INFO
)
savepoint
;
SP_INFO
save_info
=
(
SP_INFO
)
savepoint
;
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
tokudb_trx_data
*
trx
=
(
tokudb_trx_data
*
)
thd_data_get
(
thd
,
hton
->
slot
);
...
@@ -820,7 +820,7 @@ cleanup:
...
@@ -820,7 +820,7 @@ cleanup:
}
}
static
int
tokudb_rollback_to_savepoint
(
handlerton
*
hton
,
THD
*
thd
,
void
*
savepoint
)
{
static
int
tokudb_rollback_to_savepoint
(
handlerton
*
hton
,
THD
*
thd
,
void
*
savepoint
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_rollback_to_savepoint
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
SP_INFO
save_info
=
(
SP_INFO
)
savepoint
;
SP_INFO
save_info
=
(
SP_INFO
)
savepoint
;
DB_TXN
*
parent
=
NULL
;
DB_TXN
*
parent
=
NULL
;
...
@@ -841,7 +841,7 @@ static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *save
...
@@ -841,7 +841,7 @@ static int tokudb_rollback_to_savepoint(handlerton * hton, THD * thd, void *save
}
}
static
int
tokudb_release_savepoint
(
handlerton
*
hton
,
THD
*
thd
,
void
*
savepoint
)
{
static
int
tokudb_release_savepoint
(
handlerton
*
hton
,
THD
*
thd
,
void
*
savepoint
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_release_savepoint
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
SP_INFO
save_info
=
(
SP_INFO
)
savepoint
;
SP_INFO
save_info
=
(
SP_INFO
)
savepoint
;
...
@@ -868,7 +868,7 @@ static int tokudb_discover(handlerton *hton, THD* thd, const char *db, const cha
...
@@ -868,7 +868,7 @@ static int tokudb_discover(handlerton *hton, THD* thd, const char *db, const cha
static
int
tokudb_discover2
(
handlerton
*
hton
,
THD
*
thd
,
const
char
*
db
,
const
char
*
name
,
bool
translate_name
,
static
int
tokudb_discover2
(
handlerton
*
hton
,
THD
*
thd
,
const
char
*
db
,
const
char
*
name
,
bool
translate_name
,
uchar
**
frmblob
,
size_t
*
frmlen
)
{
uchar
**
frmblob
,
size_t
*
frmlen
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_discover
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
DB
*
status_db
=
NULL
;
DB
*
status_db
=
NULL
;
DB_TXN
*
txn
=
NULL
;
DB_TXN
*
txn
=
NULL
;
...
@@ -926,7 +926,7 @@ cleanup:
...
@@ -926,7 +926,7 @@ cleanup:
extern
sys_var
*
intern_find_sys_var
(
const
char
*
str
,
uint
length
,
bool
no_error
);
extern
sys_var
*
intern_find_sys_var
(
const
char
*
str
,
uint
length
,
bool
no_error
);
static
bool
tokudb_show_engine_status
(
THD
*
thd
,
stat_print_fn
*
stat_print
)
{
static
bool
tokudb_show_engine_status
(
THD
*
thd
,
stat_print_fn
*
stat_print
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_show_engine_status
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
uint64_t
panic
;
uint64_t
panic
;
const
int
panic_string_len
=
1024
;
const
int
panic_string_len
=
1024
;
...
@@ -1101,7 +1101,7 @@ static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, con
...
@@ -1101,7 +1101,7 @@ static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, con
}
}
static
void
tokudb_cleanup_log_files
(
void
)
{
static
void
tokudb_cleanup_log_files
(
void
)
{
TOKUDB_DBUG_ENTER
(
"
tokudb_cleanup_log_files
"
);
TOKUDB_DBUG_ENTER
(
""
);
char
**
names
;
char
**
names
;
int
error
;
int
error
;
...
@@ -1119,7 +1119,7 @@ static void tokudb_cleanup_log_files(void) {
...
@@ -1119,7 +1119,7 @@ static void tokudb_cleanup_log_files(void) {
for
(
np
=
names
;
*
np
;
++
np
)
{
for
(
np
=
names
;
*
np
;
++
np
)
{
#if 1
#if 1
if
(
tokudb_debug
)
if
(
tokudb_debug
)
TOKUDB_TRACE
(
"%s:cleanup:%s
\n
"
,
__FUNCTION__
,
*
np
);
TOKUDB_TRACE
(
"%s:cleanup:%s"
,
__FUNCTION__
,
*
np
);
#else
#else
my_delete
(
*
np
,
MYF
(
MY_WME
));
my_delete
(
*
np
,
MYF
(
MY_WME
));
#endif
#endif
...
@@ -1368,7 +1368,7 @@ static int tokudb_file_map_fill_table(THD *thd, TABLE_LIST *tables, Item *cond)
...
@@ -1368,7 +1368,7 @@ static int tokudb_file_map_fill_table(THD *thd, TABLE_LIST *tables, Item *cond)
#else
#else
static
int
tokudb_file_map_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_file_map_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
#endif
TOKUDB_DBUG_ENTER
(
"
%s"
,
__FUNCTION__
);
TOKUDB_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
TABLE
*
table
=
tables
->
table
;
TABLE
*
table
=
tables
->
table
;
...
@@ -1513,7 +1513,7 @@ static int tokudb_fractal_tree_info_fill_table(THD *thd, TABLE_LIST *tables, Ite
...
@@ -1513,7 +1513,7 @@ static int tokudb_fractal_tree_info_fill_table(THD *thd, TABLE_LIST *tables, Ite
#else
#else
static
int
tokudb_fractal_tree_info_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_fractal_tree_info_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
#endif
TOKUDB_DBUG_ENTER
(
"
%s"
,
__FUNCTION__
);
TOKUDB_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
TABLE
*
table
=
tables
->
table
;
TABLE
*
table
=
tables
->
table
;
...
@@ -1725,7 +1725,7 @@ static int tokudb_fractal_tree_block_map_fill_table(THD *thd, TABLE_LIST *tables
...
@@ -1725,7 +1725,7 @@ static int tokudb_fractal_tree_block_map_fill_table(THD *thd, TABLE_LIST *tables
#else
#else
static
int
tokudb_fractal_tree_block_map_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_fractal_tree_block_map_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
#endif
TOKUDB_DBUG_ENTER
(
"
%s"
,
__FUNCTION__
);
TOKUDB_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
TABLE
*
table
=
tables
->
table
;
TABLE
*
table
=
tables
->
table
;
...
@@ -1838,7 +1838,7 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
...
@@ -1838,7 +1838,7 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
}
}
// dump to stderr
// dump to stderr
if
(
lock_timeout_debug
&
2
)
{
if
(
lock_timeout_debug
&
2
)
{
fprintf
(
stderr
,
"tokudb_lock_timeout: %s
\n
"
,
log_str
.
c_ptr
());
fprintf
(
stderr
,
"tokudb_lock_timeout: %s"
,
log_str
.
c_ptr
());
}
}
}
}
}
}
...
@@ -1871,7 +1871,7 @@ static int tokudb_trx_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
...
@@ -1871,7 +1871,7 @@ static int tokudb_trx_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
#else
static
int
tokudb_trx_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_trx_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
#endif
TOKUDB_DBUG_ENTER
(
"
%s"
,
__FUNCTION__
);
TOKUDB_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
...
@@ -1942,7 +1942,7 @@ static int tokudb_lock_waits_fill_table(THD *thd, TABLE_LIST *tables, Item *cond
...
@@ -1942,7 +1942,7 @@ static int tokudb_lock_waits_fill_table(THD *thd, TABLE_LIST *tables, Item *cond
#else
#else
static
int
tokudb_lock_waits_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_lock_waits_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
#endif
TOKUDB_DBUG_ENTER
(
"
%s"
,
__FUNCTION__
);
TOKUDB_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
...
@@ -2019,7 +2019,7 @@ static int tokudb_locks_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
...
@@ -2019,7 +2019,7 @@ static int tokudb_locks_fill_table(THD *thd, TABLE_LIST *tables, Item *cond) {
#else
#else
static
int
tokudb_locks_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
static
int
tokudb_locks_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
#endif
#endif
TOKUDB_DBUG_ENTER
(
"
%s"
,
__FUNCTION__
);
TOKUDB_DBUG_ENTER
(
"
"
);
int
error
;
int
error
;
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
rw_rdlock
(
&
tokudb_hton_initialized_lock
);
...
@@ -2053,7 +2053,7 @@ enum { TOKUDB_PLUGIN_VERSION = 0x0400 };
...
@@ -2053,7 +2053,7 @@ enum { TOKUDB_PLUGIN_VERSION = 0x0400 };
// Retrieves variables for information_schema.global_status.
// Retrieves variables for information_schema.global_status.
// Names (columnname) are automatically converted to upper case, and prefixed with "TOKUDB_"
// Names (columnname) are automatically converted to upper case, and prefixed with "TOKUDB_"
static
int
show_tokudb_vars
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
)
{
static
int
show_tokudb_vars
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
)
{
TOKUDB_DBUG_ENTER
(
"
show_tokudb_vars
"
);
TOKUDB_DBUG_ENTER
(
""
);
int
error
;
int
error
;
uint64_t
panic
;
uint64_t
panic
;
...
...
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