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
b8d7ee97
Commit
b8d7ee97
authored
Nov 09, 2013
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic tokudb running in mysql 5.7
parent
eef01795
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
193 additions
and
116 deletions
+193
-116
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+71
-67
storage/tokudb/ha_tokudb_alter_56.cc
storage/tokudb/ha_tokudb_alter_56.cc
+20
-16
storage/tokudb/hatoku_cmp.cc
storage/tokudb/hatoku_cmp.cc
+6
-3
storage/tokudb/hatoku_cmp.h
storage/tokudb/hatoku_cmp.h
+2
-1
storage/tokudb/hatoku_defines.h
storage/tokudb/hatoku_defines.h
+63
-1
storage/tokudb/hatoku_hton.cc
storage/tokudb/hatoku_hton.cc
+23
-20
storage/tokudb/tokudb_update_fun.cc
storage/tokudb/tokudb_update_fun.cc
+8
-8
No files found.
storage/tokudb/ha_tokudb.cc
View file @
b8d7ee97
...
...
@@ -183,9 +183,9 @@ static int allocate_key_and_col_info ( TABLE_SHARE* table_share, KEY_AND_COL_INF
//
// create the field lengths
//
kc_info
->
field_lengths
=
(
uint16_t
*
)
my_malloc
(
table_share
->
fields
*
sizeof
(
uint16_t
),
MYF
(
MY_WME
|
MY_ZEROFILL
));
kc_info
->
length_bytes
=
(
uchar
*
)
my_malloc
(
table_share
->
fields
,
MYF
(
MY_WME
|
MY_ZEROFILL
));
kc_info
->
blob_fields
=
(
uint32_t
*
)
my_malloc
(
table_share
->
fields
*
sizeof
(
uint32_t
),
MYF
(
MY_WME
|
MY_ZEROFILL
));
kc_info
->
field_lengths
=
(
uint16_t
*
)
tokudb_
my_malloc
(
table_share
->
fields
*
sizeof
(
uint16_t
),
MYF
(
MY_WME
|
MY_ZEROFILL
));
kc_info
->
length_bytes
=
(
uchar
*
)
tokudb_
my_malloc
(
table_share
->
fields
,
MYF
(
MY_WME
|
MY_ZEROFILL
));
kc_info
->
blob_fields
=
(
uint32_t
*
)
tokudb_
my_malloc
(
table_share
->
fields
*
sizeof
(
uint32_t
),
MYF
(
MY_WME
|
MY_ZEROFILL
));
if
(
kc_info
->
field_lengths
==
NULL
||
kc_info
->
length_bytes
==
NULL
||
...
...
@@ -198,9 +198,9 @@ exit:
for
(
uint
i
=
0
;
MAX_KEY
+
1
;
i
++
)
{
bitmap_free
(
&
kc_info
->
key_filters
[
i
]);
}
my_free
(
kc_info
->
field_lengths
);
my_free
(
kc_info
->
length_bytes
);
my_free
(
kc_info
->
blob_fields
);
tokudb_
my_free
(
kc_info
->
field_lengths
);
tokudb_
my_free
(
kc_info
->
length_bytes
);
tokudb_
my_free
(
kc_info
->
blob_fields
);
}
return
error
;
}
...
...
@@ -227,7 +227,7 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE_SHARE* table_share)
// create share and fill it with all zeroes
// hence, all pointers are initialized to NULL
//
share
=
(
TOKUDB_SHARE
*
)
my_multi_malloc
(
MYF
(
MY_WME
|
MY_ZEROFILL
),
share
=
(
TOKUDB_SHARE
*
)
tokudb_
my_multi_malloc
(
MYF
(
MY_WME
|
MY_ZEROFILL
),
&
share
,
sizeof
(
*
share
),
&
tmp_name
,
length
+
1
,
NullS
...
...
@@ -258,7 +258,7 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE_SHARE* table_share)
exit:
if
(
error
)
{
pthread_mutex_destroy
(
&
share
->
mutex
);
my_free
((
uchar
*
)
share
);
tokudb_
my_free
((
uchar
*
)
share
);
share
=
NULL
;
}
return
share
;
...
...
@@ -271,13 +271,13 @@ static void free_key_and_col_info (KEY_AND_COL_INFO* kc_info) {
}
for
(
uint
i
=
0
;
i
<
MAX_KEY
+
1
;
i
++
)
{
my_free
(
kc_info
->
cp_info
[
i
]);
tokudb_
my_free
(
kc_info
->
cp_info
[
i
]);
kc_info
->
cp_info
[
i
]
=
NULL
;
// 3144
}
my_free
(
kc_info
->
field_lengths
);
my_free
(
kc_info
->
length_bytes
);
my_free
(
kc_info
->
blob_fields
);
tokudb_
my_free
(
kc_info
->
field_lengths
);
tokudb_
my_free
(
kc_info
->
length_bytes
);
tokudb_
my_free
(
kc_info
->
blob_fields
);
}
//
...
...
@@ -322,7 +322,7 @@ static int free_share(TOKUDB_SHARE * share, bool mutex_is_locked) {
pthread_mutex_destroy
(
&
share
->
mutex
);
rwlock_destroy
(
&
share
->
num_DBs_lock
);
my_free
((
uchar
*
)
share
);
tokudb_
my_free
((
uchar
*
)
share
);
}
return
result
;
...
...
@@ -373,7 +373,8 @@ static inline bool do_ignore_flag_optimization(THD* thd, TABLE* table, bool opt_
}
static
inline
uint
get_key_parts
(
const
KEY
*
key
)
{
#if 50609 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50609 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
return
key
->
user_defined_key_parts
;
#else
return
key
->
key_parts
;
...
...
@@ -382,7 +383,8 @@ static inline uint get_key_parts(const KEY *key) {
#if TOKU_INCLUDE_EXTENDED_KEYS
static
inline
uint
get_ext_key_parts
(
const
KEY
*
key
)
{
#if 50609 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50609 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
return
key
->
actual_key_parts
;
#elif defined(MARIADB_BASE_VERSION)
return
key
->
ext_key_parts
;
...
...
@@ -500,7 +502,7 @@ static int smart_dbt_do_nothing (DBT const *key, DBT const *row, void *context)
static
int
smart_dbt_metacallback
(
DBT
const
*
key
,
DBT
const
*
row
,
void
*
context
)
{
DBT
*
val
=
(
DBT
*
)
context
;
val
->
data
=
my_malloc
(
row
->
size
,
MYF
(
MY_WME
|
MY_ZEROFILL
));
val
->
data
=
tokudb_
my_malloc
(
row
->
size
,
MYF
(
MY_WME
|
MY_ZEROFILL
));
if
(
val
->
data
==
NULL
)
return
ENOMEM
;
memcpy
(
val
->
data
,
row
->
data
,
row
->
size
);
val
->
size
=
row
->
size
;
...
...
@@ -1083,7 +1085,7 @@ static int rename_table_in_metadata(const char *from, const char *to, DB_TXN* tx
error
=
0
;
cleanup:
my_free
(
val
.
data
);
tokudb_
my_free
(
val
.
data
);
return
error
;
}
...
...
@@ -1121,7 +1123,7 @@ static int check_table_in_metadata(const char *name, bool* table_found, DB_TXN*
static
int
create_tokudb_trx_data_instance
(
tokudb_trx_data
**
out_trx
)
{
int
error
;
tokudb_trx_data
*
trx
=
NULL
;
trx
=
(
tokudb_trx_data
*
)
my_malloc
(
sizeof
(
*
trx
),
MYF
(
MY_ZEROFILL
));
trx
=
(
tokudb_trx_data
*
)
tokudb_
my_malloc
(
sizeof
(
*
trx
),
MYF
(
MY_ZEROFILL
));
if
(
!
trx
)
{
error
=
ENOMEM
;
goto
cleanup
;
...
...
@@ -1395,7 +1397,7 @@ bool ha_tokudb::has_auto_increment_flag(uint* index) {
static
int
open_status_dictionary
(
DB
**
ptr
,
const
char
*
name
,
DB_TXN
*
txn
)
{
int
error
;
char
*
newname
=
NULL
;
newname
=
(
char
*
)
my_malloc
(
newname
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
if
(
newname
==
NULL
)
{
...
...
@@ -1409,7 +1411,7 @@ static int open_status_dictionary(DB** ptr, const char* name, DB_TXN* txn) {
error
=
tokudb
::
open_status
(
db_env
,
ptr
,
newname
,
txn
);
cleanup:
my_free
(
newname
);
tokudb_
my_free
(
newname
);
return
error
;
}
...
...
@@ -1421,7 +1423,7 @@ int ha_tokudb::open_main_dictionary(const char* name, bool is_read_only, DB_TXN*
assert
(
share
->
file
==
NULL
);
assert
(
share
->
key_file
[
primary_key
]
==
NULL
);
newname
=
(
char
*
)
my_malloc
(
newname
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
|
MY_ZEROFILL
)
);
...
...
@@ -1459,7 +1461,7 @@ exit:
share
->
key_file
[
primary_key
]
=
NULL
;
}
}
my_free
(
newname
);
tokudb_
my_free
(
newname
);
return
error
;
}
...
...
@@ -1476,7 +1478,7 @@ int ha_tokudb::open_secondary_dictionary(DB** ptr, KEY* key_info, const char* na
sprintf
(
dict_name
,
"key-%s"
,
key_info
->
name
);
newname_len
=
get_max_dict_name_path_length
(
name
);
newname
=
(
char
*
)
my_malloc
(
newname_len
,
MYF
(
MY_WME
|
MY_ZEROFILL
));
newname
=
(
char
*
)
tokudb_
my_malloc
(
newname_len
,
MYF
(
MY_WME
|
MY_ZEROFILL
));
if
(
newname
==
NULL
)
{
error
=
ENOMEM
;
goto
cleanup
;
...
...
@@ -1505,7 +1507,7 @@ cleanup:
*
ptr
=
NULL
;
}
}
my_free
(
newname
);
tokudb_
my_free
(
newname
);
return
error
;
}
...
...
@@ -1515,7 +1517,7 @@ static int initialize_col_pack_info(KEY_AND_COL_INFO* kc_info, TABLE_SHARE* tabl
// set up the cp_info
//
assert
(
kc_info
->
cp_info
[
keynr
]
==
NULL
);
kc_info
->
cp_info
[
keynr
]
=
(
COL_PACK_INFO
*
)
my_malloc
(
kc_info
->
cp_info
[
keynr
]
=
(
COL_PACK_INFO
*
)
tokudb_
my_malloc
(
table_share
->
fields
*
sizeof
(
COL_PACK_INFO
),
MYF
(
MY_WME
|
MY_ZEROFILL
)
);
...
...
@@ -1567,7 +1569,7 @@ exit:
// reset the kc_info state at keynr
static
void
reset_key_and_col_info
(
KEY_AND_COL_INFO
*
kc_info
,
uint
keynr
)
{
bitmap_clear_all
(
&
kc_info
->
key_filters
[
keynr
]);
my_free
(
kc_info
->
cp_info
[
keynr
]);
tokudb_
my_free
(
kc_info
->
cp_info
[
keynr
]);
kc_info
->
cp_info
[
keynr
]
=
NULL
;
kc_info
->
mcp_info
[
keynr
]
=
(
MULTI_COL_PACK_INFO
)
{
0
,
0
};
}
...
...
@@ -1901,7 +1903,7 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
// the "+ 1" is for the first byte that states +/- infinity
// multiply everything by 2 to account for clustered keys having a key and primary key together
max_key_length
=
2
*
(
table_share
->
max_key_length
+
MAX_REF_PARTS
*
3
+
sizeof
(
uchar
));
alloc_ptr
=
my_multi_malloc
(
MYF
(
MY_WME
),
alloc_ptr
=
tokudb_
my_multi_malloc
(
MYF
(
MY_WME
),
&
key_buff
,
max_key_length
,
&
key_buff2
,
max_key_length
,
&
key_buff3
,
max_key_length
,
...
...
@@ -1918,21 +1920,21 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
}
size_range_query_buff
=
get_tokudb_read_buf_size
(
thd
);
range_query_buff
=
(
uchar
*
)
my_malloc
(
size_range_query_buff
,
MYF
(
MY_WME
));
range_query_buff
=
(
uchar
*
)
tokudb_
my_malloc
(
size_range_query_buff
,
MYF
(
MY_WME
));
if
(
range_query_buff
==
NULL
)
{
ret_val
=
1
;
goto
exit
;
}
alloced_rec_buff_length
=
table_share
->
rec_buff_length
+
table_share
->
fields
;
rec_buff
=
(
uchar
*
)
my_malloc
(
alloced_rec_buff_length
,
MYF
(
MY_WME
));
rec_buff
=
(
uchar
*
)
tokudb_
my_malloc
(
alloced_rec_buff_length
,
MYF
(
MY_WME
));
if
(
rec_buff
==
NULL
)
{
ret_val
=
1
;
goto
exit
;
}
alloced_update_rec_buff_length
=
alloced_rec_buff_length
;
rec_update_buff
=
(
uchar
*
)
my_malloc
(
alloced_update_rec_buff_length
,
MYF
(
MY_WME
));
rec_update_buff
=
(
uchar
*
)
tokudb_
my_malloc
(
alloced_update_rec_buff_length
,
MYF
(
MY_WME
));
if
(
rec_update_buff
==
NULL
)
{
ret_val
=
1
;
goto
exit
;
...
...
@@ -1979,13 +1981,13 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
exit:
if
(
ret_val
)
{
my_free
(
range_query_buff
);
tokudb_
my_free
(
range_query_buff
);
range_query_buff
=
NULL
;
my_free
(
alloc_ptr
);
tokudb_
my_free
(
alloc_ptr
);
alloc_ptr
=
NULL
;
my_free
(
rec_buff
);
tokudb_
my_free
(
rec_buff
);
rec_buff
=
NULL
;
my_free
(
rec_update_buff
);
tokudb_
my_free
(
rec_update_buff
);
rec_update_buff
=
NULL
;
if
(
error
)
{
...
...
@@ -2153,7 +2155,7 @@ int ha_tokudb::write_frm_data(DB* db, DB_TXN* txn, const char* frm_name) {
error
=
0
;
cleanup:
my_free
(
frm_data
);
tokudb_
my_free
(
frm_data
);
TOKUDB_DBUG_RETURN
(
error
);
}
...
...
@@ -2165,7 +2167,7 @@ static int
smart_dbt_callback_verify_frm
(
DBT
const
*
key
,
DBT
const
*
row
,
void
*
context
)
{
DBT
*
stored_frm
=
(
DBT
*
)
context
;
stored_frm
->
size
=
row
->
size
;
stored_frm
->
data
=
(
uchar
*
)
my_malloc
(
row
->
size
,
MYF
(
MY_WME
));
stored_frm
->
data
=
(
uchar
*
)
tokudb_
my_malloc
(
row
->
size
,
MYF
(
MY_WME
));
assert
(
stored_frm
->
data
);
memcpy
(
stored_frm
->
data
,
row
->
data
,
row
->
size
);
return
0
;
...
...
@@ -2217,8 +2219,8 @@ int ha_tokudb::verify_frm_data(const char* frm_name, DB_TXN* txn) {
error
=
0
;
cleanup:
my_free
(
mysql_frm_data
);
my_free
(
stored_frm
.
data
);
tokudb_
my_free
(
mysql_frm_data
);
tokudb_
my_free
(
stored_frm
.
data
);
TOKUDB_DBUG_RETURN
(
error
);
}
...
...
@@ -2263,11 +2265,11 @@ int ha_tokudb::__close() {
TOKUDB_DBUG_ENTER
(
"ha_tokudb::__close %p"
,
this
);
if
(
tokudb_debug
&
TOKUDB_DEBUG_OPEN
)
TOKUDB_TRACE
(
"close:%p
\n
"
,
this
);
my_free
(
rec_buff
);
my_free
(
rec_update_buff
);
my_free
(
blob_buff
);
my_free
(
alloc_ptr
);
my_free
(
range_query_buff
);
tokudb_
my_free
(
rec_buff
);
tokudb_
my_free
(
rec_update_buff
);
tokudb_
my_free
(
blob_buff
);
tokudb_
my_free
(
alloc_ptr
);
tokudb_
my_free
(
range_query_buff
);
for
(
uint32_t
i
=
0
;
i
<
sizeof
(
mult_key_dbt_array
)
/
sizeof
(
mult_key_dbt_array
[
0
]);
i
++
)
{
toku_dbt_array_destroy
(
&
mult_key_dbt_array
[
i
]);
}
...
...
@@ -2293,7 +2295,7 @@ int ha_tokudb::__close() {
bool
ha_tokudb
::
fix_rec_buff_for_blob
(
ulong
length
)
{
if
(
!
rec_buff
||
(
length
>
alloced_rec_buff_length
))
{
uchar
*
newptr
;
if
(
!
(
newptr
=
(
uchar
*
)
my_realloc
((
void
*
)
rec_buff
,
length
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
if
(
!
(
newptr
=
(
uchar
*
)
tokudb_
my_realloc
((
void
*
)
rec_buff
,
length
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
return
1
;
rec_buff
=
newptr
;
alloced_rec_buff_length
=
length
;
...
...
@@ -2310,7 +2312,7 @@ bool ha_tokudb::fix_rec_buff_for_blob(ulong length) {
bool
ha_tokudb
::
fix_rec_update_buff_for_blob
(
ulong
length
)
{
if
(
!
rec_update_buff
||
(
length
>
alloced_update_rec_buff_length
))
{
uchar
*
newptr
;
if
(
!
(
newptr
=
(
uchar
*
)
my_realloc
((
void
*
)
rec_update_buff
,
length
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
if
(
!
(
newptr
=
(
uchar
*
)
tokudb_
my_realloc
((
void
*
)
rec_update_buff
,
length
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
return
1
;
rec_update_buff
=
newptr
;
alloced_update_rec_buff_length
=
length
;
...
...
@@ -2447,7 +2449,7 @@ int ha_tokudb::unpack_blobs(
//
assert
(
!
((
share
->
kc_info
.
num_blobs
==
0
)
&&
(
num_bytes
>
0
))
);
if
(
num_bytes
>
num_blob_bytes
)
{
ptr
=
(
uchar
*
)
my_realloc
((
void
*
)
blob_buff
,
num_bytes
,
MYF
(
MY_ALLOW_ZERO_PTR
));
ptr
=
(
uchar
*
)
tokudb_
my_realloc
((
void
*
)
blob_buff
,
num_bytes
,
MYF
(
MY_ALLOW_ZERO_PTR
));
if
(
ptr
==
NULL
)
{
error
=
ENOMEM
;
goto
exit
;
...
...
@@ -3775,9 +3777,9 @@ void ha_tokudb::test_row_packing(uchar* record, DBT* pk_key, DBT* pk_val) {
//
//use for testing the packing of keys
//
tmp_pk_key_data
=
(
uchar
*
)
my_malloc
(
pk_key
->
size
,
MYF
(
MY_WME
));
tmp_pk_key_data
=
(
uchar
*
)
tokudb_
my_malloc
(
pk_key
->
size
,
MYF
(
MY_WME
));
assert
(
tmp_pk_key_data
);
tmp_pk_val_data
=
(
uchar
*
)
my_malloc
(
pk_val
->
size
,
MYF
(
MY_WME
));
tmp_pk_val_data
=
(
uchar
*
)
tokudb_
my_malloc
(
pk_val
->
size
,
MYF
(
MY_WME
));
assert
(
tmp_pk_val_data
);
memcpy
(
tmp_pk_key_data
,
pk_key
->
data
,
pk_key
->
size
);
memcpy
(
tmp_pk_val_data
,
pk_val
->
data
,
pk_val
->
size
);
...
...
@@ -3822,7 +3824,7 @@ void ha_tokudb::test_row_packing(uchar* record, DBT* pk_key, DBT* pk_val) {
error
=
pack_row
(
&
row
,
(
const
uchar
*
)
record
,
keynr
);
assert
(
error
==
0
);
uchar
*
tmp_buff
=
NULL
;
tmp_buff
=
(
uchar
*
)
my_malloc
(
alloced_rec_buff_length
,
MYF
(
MY_WME
));
tmp_buff
=
(
uchar
*
)
tokudb_
my_malloc
(
alloced_rec_buff_length
,
MYF
(
MY_WME
));
assert
(
tmp_buff
);
row_desc
=
(
uchar
*
)
share
->
key_file
[
keynr
]
->
descriptor
->
dbt
.
data
;
row_desc
+=
(
*
(
uint32_t
*
)
row_desc
);
...
...
@@ -3838,7 +3840,7 @@ void ha_tokudb::test_row_packing(uchar* record, DBT* pk_key, DBT* pk_val) {
assert
(
tmp_num_bytes
==
row
.
size
);
cmp
=
memcmp
(
tmp_buff
,
rec_buff
,
tmp_num_bytes
);
assert
(
cmp
==
0
);
my_free
(
tmp_buff
);
tokudb_
my_free
(
tmp_buff
);
}
}
...
...
@@ -3850,8 +3852,8 @@ void ha_tokudb::test_row_packing(uchar* record, DBT* pk_key, DBT* pk_val) {
cmp
=
memcmp
(
pk_val
->
data
,
tmp_pk_val_data
,
pk_val
->
size
);
assert
(
cmp
==
0
);
my_free
(
tmp_pk_key_data
);
my_free
(
tmp_pk_val_data
);
tokudb_
my_free
(
tmp_pk_key_data
);
tokudb_
my_free
(
tmp_pk_val_data
);
}
//
...
...
@@ -5218,7 +5220,7 @@ int ha_tokudb::fill_range_query_buf(
size_needed
=
sizeof
(
uint32_t
)
+
key
->
size
;
}
if
(
size_remaining
<
size_needed
)
{
range_query_buff
=
(
uchar
*
)
my_realloc
(
range_query_buff
=
(
uchar
*
)
tokudb_
my_realloc
(
(
void
*
)
range_query_buff
,
bytes_used_in_range_query_buff
+
size_needed
,
MYF
(
MY_WME
)
...
...
@@ -6496,6 +6498,8 @@ static inline enum row_type compression_method_to_row_type(enum toku_compression
return
ROW_TYPE_TOKU_FAST
;
case
TOKU_SMALL_COMPRESSION_METHOD
:
return
ROW_TYPE_TOKU_SMALL
;
#else
case
TOKU_ZLIB_WITHOUT_CHECKSUM_METHOD
:
#endif
case
TOKU_DEFAULT_COMPRESSION_METHOD
:
return
ROW_TYPE_DEFAULT
;
...
...
@@ -6793,10 +6797,10 @@ int ha_tokudb::create_secondary_dictionary(
max_row_desc_buff_size
=
get_max_desc_size
(
kc_info
,
form
);
row_desc_buff
=
(
uchar
*
)
my_malloc
(
max_row_desc_buff_size
,
MYF
(
MY_WME
));
row_desc_buff
=
(
uchar
*
)
tokudb_
my_malloc
(
max_row_desc_buff_size
,
MYF
(
MY_WME
));
if
(
row_desc_buff
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
newname
=
(
char
*
)
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
newname
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
if
(
newname
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
sprintf
(
dict_name
,
"key-%s"
,
key_info
->
name
);
...
...
@@ -6828,8 +6832,8 @@ int ha_tokudb::create_secondary_dictionary(
error
=
create_sub_table
(
newname
,
&
row_descriptor
,
txn
,
block_size
,
read_block_size
,
row_type_to_compression_method
(
row_type
),
is_hot_index
);
cleanup:
my_free
(
newname
);
my_free
(
row_desc_buff
);
tokudb_
my_free
(
newname
);
tokudb_
my_free
(
row_desc_buff
);
return
error
;
}
...
...
@@ -6886,10 +6890,10 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
memset
(
&
row_descriptor
,
0
,
sizeof
(
row_descriptor
));
max_row_desc_buff_size
=
get_max_desc_size
(
kc_info
,
form
);
row_desc_buff
=
(
uchar
*
)
my_malloc
(
max_row_desc_buff_size
,
MYF
(
MY_WME
));
row_desc_buff
=
(
uchar
*
)
tokudb_
my_malloc
(
max_row_desc_buff_size
,
MYF
(
MY_WME
));
if
(
row_desc_buff
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
newname
=
(
char
*
)
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
newname
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
if
(
newname
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
make_name
(
newname
,
name
,
"main"
);
...
...
@@ -6919,8 +6923,8 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
/* Create the main table that will hold the real rows */
error
=
create_sub_table
(
newname
,
&
row_descriptor
,
txn
,
block_size
,
read_block_size
,
row_type_to_compression_method
(
row_type
),
false
);
cleanup:
my_free
(
newname
);
my_free
(
row_desc_buff
);
tokudb_
my_free
(
newname
);
tokudb_
my_free
(
row_desc_buff
);
return
error
;
}
...
...
@@ -7004,7 +7008,7 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in
}
}
newname
=
(
char
*
)
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
newname
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
if
(
newname
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
if
(
trx
&&
trx
->
sub_sp_level
&&
thd_sql_command
(
thd
)
==
SQLCOM_CREATE_TABLE
)
{
...
...
@@ -7100,7 +7104,7 @@ cleanup:
commit_txn
(
txn
,
0
);
}
}
my_free
(
newname
);
tokudb_
my_free
(
newname
);
pthread_mutex_unlock
(
&
tokudb_meta_mutex
);
TOKUDB_DBUG_RETURN
(
error
);
}
...
...
@@ -7131,7 +7135,7 @@ int ha_tokudb::delete_or_rename_dictionary( const char* from_name, const char* t
char
*
new_to_name
=
NULL
;
assert
(
txn
);
new_from_name
=
(
char
*
)
my_malloc
(
new_from_name
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
from_name
),
MYF
(
MY_WME
)
);
...
...
@@ -7141,7 +7145,7 @@ int ha_tokudb::delete_or_rename_dictionary( const char* from_name, const char* t
}
if
(
!
is_delete
)
{
assert
(
to_name
);
new_to_name
=
(
char
*
)
my_malloc
(
new_to_name
=
(
char
*
)
tokudb_
my_malloc
(
get_max_dict_name_path_length
(
to_name
),
MYF
(
MY_WME
)
);
...
...
@@ -7177,8 +7181,8 @@ int ha_tokudb::delete_or_rename_dictionary( const char* from_name, const char* t
if
(
error
)
{
goto
cleanup
;
}
cleanup:
my_free
(
new_from_name
);
my_free
(
new_to_name
);
tokudb_
my_free
(
new_from_name
);
tokudb_
my_free
(
new_to_name
);
return
error
;
}
...
...
storage/tokudb/ha_tokudb_alter_56.cc
View file @
b8d7ee97
...
...
@@ -92,6 +92,8 @@ PATENT RIGHTS GRANT:
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099
#define TOKU_ALTER_RENAME ALTER_RENAME_56
#elif 50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799
#define TOKU_ALTER_RENAME ALTER_RENAME
#elif 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#define TOKU_ALTER_RENAME ALTER_RENAME
#elif 50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599
...
...
@@ -492,7 +494,8 @@ bool ha_tokudb::inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha
if
(
error
==
0
&&
ctx
->
reset_card
)
tokudb
::
set_card_from_status
(
share
->
status_block
,
ctx
->
alter_txn
,
table
->
s
,
altered_table
->
s
);
#if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
if
(
error
==
0
&&
(
TOKU_PARTITION_WRITE_FRM_DATA
||
altered_table
->
part_info
==
NULL
))
{
error
=
write_frm_data
(
share
->
status_block
,
ctx
->
alter_txn
,
altered_table
->
s
->
path
.
str
);
}
...
...
@@ -510,7 +513,7 @@ bool ha_tokudb::inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha
int
ha_tokudb
::
alter_table_add_index
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
// sort keys in add index order
KEY
*
key_info
=
(
KEY
*
)
my_malloc
(
sizeof
(
KEY
)
*
ha_alter_info
->
index_add_count
,
MYF
(
MY_WME
));
KEY
*
key_info
=
(
KEY
*
)
tokudb_
my_malloc
(
sizeof
(
KEY
)
*
ha_alter_info
->
index_add_count
,
MYF
(
MY_WME
));
for
(
uint
i
=
0
;
i
<
ha_alter_info
->
index_add_count
;
i
++
)
{
KEY
*
key
=
&
key_info
[
i
];
*
key
=
ha_alter_info
->
key_info_buffer
[
ha_alter_info
->
index_add_buffer
[
i
]];
...
...
@@ -529,7 +532,7 @@ int ha_tokudb::alter_table_add_index(TABLE *altered_table, Alter_inplace_info *h
last_dup_key
=
MAX_KEY
;
}
my_free
(
key_info
);
tokudb_
my_free
(
key_info
);
if
(
error
==
0
)
ctx
->
reset_card
=
true
;
...
...
@@ -619,7 +622,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
4
+
num_columns
*
(
1
+
1
+
4
+
1
+
1
+
4
)
+
altered_table
->
s
->
reclength
+
// max dynamic row_mutator
(
4
+
share
->
kc_info
.
num_blobs
)
+
// max static blob size
(
num_columns
*
(
1
+
4
+
1
+
4
));
// max dynamic blob size
column_extra
=
(
uchar
*
)
my_malloc
(
max_column_extra_size
,
MYF
(
MY_WME
));
column_extra
=
(
uchar
*
)
tokudb_
my_malloc
(
max_column_extra_size
,
MYF
(
MY_WME
));
if
(
column_extra
==
NULL
)
{
error
=
ENOMEM
;
goto
cleanup
;
}
for
(
uint32_t
i
=
0
;
i
<
curr_num_DBs
;
i
++
)
{
...
...
@@ -629,7 +632,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
if
(
error
)
goto
cleanup
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
my_free
(
row_descriptor
.
data
);
tokudb_
my_free
(
row_descriptor
.
data
);
if
(
error
)
goto
cleanup
;
...
...
@@ -660,7 +663,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
error
=
0
;
cleanup:
my_free
(
column_extra
);
tokudb_
my_free
(
column_extra
);
return
error
;
}
...
...
@@ -674,12 +677,13 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
bool
result
=
false
;
// success
if
(
commit
)
{
#if 50613 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50613 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
if
(
ha_alter_info
->
group_commit_ctx
)
{
ha_alter_info
->
group_commit_ctx
=
NULL
;
}
#endif
#if
50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599
#if
(50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599)
if
(
TOKU_PARTITION_WRITE_FRM_DATA
||
altered_table
->
part_info
==
NULL
)
{
int
error
=
write_frm_data
(
share
->
status_block
,
ctx
->
alter_txn
,
altered_table
->
s
->
path
.
str
);
if
(
error
)
{
...
...
@@ -753,7 +757,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
if
(
error
)
break
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
my_free
(
row_descriptor
.
data
);
tokudb_
my_free
(
row_descriptor
.
data
);
if
(
error
)
break
;
...
...
@@ -766,7 +770,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
// make the expand variable offsets message
DBT
expand
;
memset
(
&
expand
,
0
,
sizeof
expand
);
expand
.
size
=
sizeof
(
uchar
)
+
sizeof
offset_start
+
sizeof
offset_end
;
expand
.
data
=
my_malloc
(
expand
.
size
,
MYF
(
MY_WME
));
expand
.
data
=
tokudb_
my_malloc
(
expand
.
size
,
MYF
(
MY_WME
));
if
(
!
expand
.
data
)
{
error
=
ENOMEM
;
break
;
...
...
@@ -783,7 +787,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
// and broadcast it into the tree
error
=
share
->
key_file
[
i
]
->
update_broadcast
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
expand
,
DB_IS_RESETTING_OP
);
my_free
(
expand
.
data
);
tokudb_
my_free
(
expand
.
data
);
if
(
error
)
break
;
}
...
...
@@ -935,7 +939,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
if
(
error
)
break
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
my_free
(
row_descriptor
.
data
);
tokudb_
my_free
(
row_descriptor
.
data
);
if
(
error
)
break
;
...
...
@@ -955,7 +959,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
expand
.
size
=
sizeof
operation
+
sizeof
new_offset
+
sizeof
old_length
+
sizeof
new_length
;
if
(
operation
==
UPDATE_OP_EXPAND_CHAR
||
operation
==
UPDATE_OP_EXPAND_BINARY
)
expand
.
size
+=
sizeof
pad_char
;
expand
.
data
=
my_malloc
(
expand
.
size
,
MYF
(
MY_WME
));
expand
.
data
=
tokudb_
my_malloc
(
expand
.
size
,
MYF
(
MY_WME
));
if
(
!
expand
.
data
)
{
error
=
ENOMEM
;
break
;
...
...
@@ -984,7 +988,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
// and broadcast it into the tree
error
=
share
->
key_file
[
i
]
->
update_broadcast
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
expand
,
DB_IS_RESETTING_OP
);
my_free
(
expand
.
data
);
tokudb_
my_free
(
expand
.
data
);
if
(
error
)
break
;
}
...
...
@@ -1014,7 +1018,7 @@ int ha_tokudb::alter_table_expand_blobs(TABLE *altered_table, Alter_inplace_info
if
(
error
)
break
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
my_free
(
row_descriptor
.
data
);
tokudb_
my_free
(
row_descriptor
.
data
);
if
(
error
)
break
;
...
...
@@ -1144,7 +1148,7 @@ int ha_tokudb::new_row_descriptor(TABLE *table, TABLE *altered_table, Alter_inpl
int
error
=
0
;
tokudb_alter_ctx
*
ctx
=
static_cast
<
tokudb_alter_ctx
*>
(
ha_alter_info
->
handler_ctx
);
row_descriptor
->
size
=
get_max_desc_size
(
ctx
->
altered_table_kc_info
,
altered_table
);
row_descriptor
->
data
=
(
uchar
*
)
my_malloc
(
row_descriptor
->
size
,
MYF
(
MY_WME
));
row_descriptor
->
data
=
(
uchar
*
)
tokudb_
my_malloc
(
row_descriptor
->
size
,
MYF
(
MY_WME
));
if
(
row_descriptor
->
data
==
NULL
)
{
error
=
ENOMEM
;
}
else
{
...
...
storage/tokudb/hatoku_cmp.cc
View file @
b8d7ee97
...
...
@@ -117,7 +117,8 @@ bool field_valid_for_tokudb_table(Field* field) {
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_FLOAT
:
#if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
case
MYSQL_TYPE_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
...
...
@@ -264,7 +265,8 @@ TOKU_TYPE mysql_to_toku_type (Field* field) {
case
MYSQL_TYPE_FLOAT
:
ret_val
=
toku_type_float
;
goto
exit
;
#if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
case
MYSQL_TYPE_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
...
...
@@ -3224,7 +3226,8 @@ bool fields_are_same_type(
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_TIMESTAMP
:
#if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
case
MYSQL_TYPE_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
...
...
storage/tokudb/hatoku_cmp.h
View file @
b8d7ee97
...
...
@@ -263,7 +263,8 @@ static inline const uchar* unpack_toku_field_blob(
}
static
inline
uint
get_null_offset
(
TABLE
*
table
,
Field
*
field
)
{
#if 50606 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#if (50606 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
return
field
->
null_offset
(
table
->
record
[
0
]);
#else
return
(
uint
)
((
uchar
*
)
field
->
null_ptr
-
(
uchar
*
)
table
->
record
[
0
]);
...
...
storage/tokudb/hatoku_defines.h
View file @
b8d7ee97
...
...
@@ -121,7 +121,13 @@ PATENT RIGHTS GRANT:
#if defined(TOKUDB_PATCHES) && TOKUDB_PATCHES == 0
#elif 50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799
#define TOKU_USE_DB_TYPE_UNKNOWN 1
#define TOKU_INCLUDE_ALTER_56 1
#define TOKU_PARTITION_WRITE_FRM_DATA 0
#elif 50613 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#define TOKU_USE_DB_TYPE_TOKUDB 1
#define TOKU_INCLUDE_ALTER_56 1
#define TOKU_INCLUDE_ROW_TYPE_COMPRESSION 1
#define TOKU_INCLUDE_XA 1
...
...
@@ -133,6 +139,7 @@ PATENT RIGHTS GRANT:
#endif
#elif 50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599
#define TOKU_USE_OTHER_DB_TYPE 1
#define TOKU_INCLUDE_ALTER_56 1
#define TOKU_INCLUDE_ALTER_55 1
#define TOKU_INCLUDE_ROW_TYPE_COMPRESSION 1
...
...
@@ -143,7 +150,6 @@ PATENT RIGHTS GRANT:
#if defined(MARIADB_BASE_VERSION)
#define TOKU_INCLUDE_EXTENDED_KEYS 1
#endif
#define TOKU_INCLUDE_OTHER_DB_TYPE 1
#define TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL 1
#else
...
...
@@ -354,4 +360,60 @@ void toku_hton_assert_fail(const char*/*expr_as_string*/,const char */*fun*/,con
#undef assert
#define assert(expr) ((expr) ? (void)0 : toku_hton_assert_fail(#expr, __FUNCTION__, __FILE__, __LINE__, errno))
static
inline
void
*
tokudb_my_malloc
(
size_t
s
,
myf
flags
)
{
#if 50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799
return
my_malloc
(
0
,
s
,
flags
);
#else
return
my_malloc
(
s
,
flags
);
#endif
}
static
inline
void
*
tokudb_my_realloc
(
void
*
p
,
size_t
s
,
myf
flags
)
{
#if 50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799
return
my_realloc
(
0
,
p
,
s
,
flags
);
#else
return
my_realloc
(
p
,
s
,
flags
);
#endif
}
static
inline
void
tokudb_my_free
(
void
*
ptr
)
{
my_free
(
ptr
);
}
static
inline
char
*
tokudb_my_strdup
(
const
char
*
p
,
myf
flags
)
{
#if 50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799
return
my_strdup
(
0
,
p
,
flags
);
#else
return
my_strdup
(
p
,
flags
);
#endif
}
static
inline
void
*
tokudb_my_multi_malloc
(
myf
myFlags
,
...)
{
va_list
args
;
char
**
ptr
,
*
start
,
*
res
;
size_t
tot_length
,
length
;
va_start
(
args
,
myFlags
);
tot_length
=
0
;
while
((
ptr
=
va_arg
(
args
,
char
**
)))
{
length
=
va_arg
(
args
,
uint
);
tot_length
+=
ALIGN_SIZE
(
length
);
}
va_end
(
args
);
if
(
!
(
start
=
(
char
*
)
tokudb_my_malloc
(
tot_length
,
myFlags
)))
{
return
0
;
}
va_start
(
args
,
myFlags
);
res
=
start
;
while
((
ptr
=
va_arg
(
args
,
char
**
)))
{
*
ptr
=
res
;
length
=
va_arg
(
args
,
uint
);
res
+=
ALIGN_SIZE
(
length
);
}
va_end
(
args
);
return
start
;
}
#endif
storage/tokudb/hatoku_hton.cc
View file @
b8d7ee97
...
...
@@ -315,7 +315,7 @@ static int tokudb_init_func(void *p) {
// tokudb_hton->flags= HTON_CAN_RECREATE; // QQQ this came from skeleton
tokudb_hton
->
flags
=
HTON_CLOSE_CURSORS_AT_COMMIT
;
#if TOKU_INCLUDE_EXTENDED_KEYS
#if
defined(TOKU_INCLUDE_EXTENDED_KEYS) &&
TOKU_INCLUDE_EXTENDED_KEYS
#if defined(HTON_SUPPORTS_EXTENDED_KEYS)
tokudb_hton
->
flags
|=
HTON_SUPPORTS_EXTENDED_KEYS
;
#endif
...
...
@@ -324,13 +324,16 @@ static int tokudb_init_func(void *p) {
#endif
#endif
#if TOKU_INCLUDE_OTHER_DB_TYPE
// we have historically been a dynamic storage engine, so we set db_type according.
// however, extended keys is triggered off of the db_type, so tokudb adds another type so that extended keys works
#if defined(TOKU_USE_DB_TYPE_TOKUDB) && TOKU_USE_DB_TYPE_TOKUDB
tokudb_hton
->
db_type
=
DB_TYPE_TOKUDB
;
#elif defined(TOKU_USE_DB_TYPE_UNKNOWN) && TOKU_USE_DB_TYPE_UNKNOWN
tokudb_hton
->
db_type
=
DB_TYPE_UNKNOWN
;
#elif defined(TOKU_USE_OTHER_DB_TYPE) && TOKU_USE_OTHER_DB_TYPE
// extended keys is triggered off of the db_type, so tokudb adds another type so that extended keys works
tokudb_hton
->
db_type
=
DB_TYPE_UNKNOWN
;
tokudb_hton
->
other_db_type
=
DB_TYPE_TOKUDB
;
#else
tokudb_hton
->
db_type
=
DB_TYPE_TOKUDB
;
#error
#endif
tokudb_hton
->
create
=
tokudb_create_handler
;
...
...
@@ -491,8 +494,8 @@ static int tokudb_init_func(void *p) {
{
const
myf
mem_flags
=
MY_FAE
|
MY_WME
|
MY_ZEROFILL
|
MY_ALLOW_ZERO_PTR
|
MY_FREE_ON_ERROR
;
toku_global_status_variables
=
(
SHOW_VAR
*
)
my_malloc
(
sizeof
(
*
toku_global_status_variables
)
*
toku_global_status_max_rows
,
mem_flags
);
toku_global_status_rows
=
(
TOKU_ENGINE_STATUS_ROW_S
*
)
my_malloc
(
sizeof
(
*
toku_global_status_rows
)
*
toku_global_status_max_rows
,
mem_flags
);
toku_global_status_variables
=
(
SHOW_VAR
*
)
tokudb_
my_malloc
(
sizeof
(
*
toku_global_status_variables
)
*
toku_global_status_max_rows
,
mem_flags
);
toku_global_status_rows
=
(
TOKU_ENGINE_STATUS_ROW_S
*
)
tokudb_
my_malloc
(
sizeof
(
*
toku_global_status_rows
)
*
toku_global_status_max_rows
,
mem_flags
);
}
r
=
db_create
(
&
metadata_db
,
db_env
,
0
);
...
...
@@ -550,9 +553,9 @@ error:
static
int
tokudb_done_func
(
void
*
p
)
{
TOKUDB_DBUG_ENTER
(
"tokudb_done_func"
);
my_free
(
toku_global_status_variables
);
tokudb_
my_free
(
toku_global_status_variables
);
toku_global_status_variables
=
NULL
;
my_free
(
toku_global_status_rows
);
tokudb_
my_free
(
toku_global_status_rows
);
toku_global_status_rows
=
NULL
;
my_hash_free
(
&
tokudb_open_tables
);
pthread_mutex_destroy
(
&
tokudb_mutex
);
...
...
@@ -604,7 +607,7 @@ static int tokudb_close_connection(handlerton * hton, THD * thd) {
if
(
trx
&&
trx
->
checkpoint_lock_taken
)
{
error
=
db_env
->
checkpointing_resume
(
db_env
);
}
my_free
(
trx
);
tokudb_
my_free
(
trx
);
return
error
;
}
...
...
@@ -1595,10 +1598,10 @@ static int tokudb_report_fractal_tree_block_map_iterator(uint64_t checkpoint_cou
assert
(
num_rows
>
0
);
if
(
e
->
num_rows
==
0
)
{
e
->
checkpoint_counts
=
(
uint64_t
*
)
my_malloc
(
num_rows
*
(
sizeof
*
e
->
checkpoint_counts
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
blocknums
=
(
int64_t
*
)
my_malloc
(
num_rows
*
(
sizeof
*
e
->
blocknums
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
diskoffs
=
(
int64_t
*
)
my_malloc
(
num_rows
*
(
sizeof
*
e
->
diskoffs
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
sizes
=
(
int64_t
*
)
my_malloc
(
num_rows
*
(
sizeof
*
e
->
sizes
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
checkpoint_counts
=
(
uint64_t
*
)
tokudb_
my_malloc
(
num_rows
*
(
sizeof
*
e
->
checkpoint_counts
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
blocknums
=
(
int64_t
*
)
tokudb_
my_malloc
(
num_rows
*
(
sizeof
*
e
->
blocknums
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
diskoffs
=
(
int64_t
*
)
tokudb_
my_malloc
(
num_rows
*
(
sizeof
*
e
->
diskoffs
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
sizes
=
(
int64_t
*
)
tokudb_
my_malloc
(
num_rows
*
(
sizeof
*
e
->
sizes
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
num_rows
=
num_rows
;
}
...
...
@@ -1678,19 +1681,19 @@ static int tokudb_report_fractal_tree_block_map_for_db(const DBT *dname, const D
exit:
if
(
e
.
checkpoint_counts
!=
NULL
)
{
my_free
(
e
.
checkpoint_counts
);
tokudb_
my_free
(
e
.
checkpoint_counts
);
e
.
checkpoint_counts
=
NULL
;
}
if
(
e
.
blocknums
!=
NULL
)
{
my_free
(
e
.
blocknums
);
tokudb_
my_free
(
e
.
blocknums
);
e
.
blocknums
=
NULL
;
}
if
(
e
.
diskoffs
!=
NULL
)
{
my_free
(
e
.
diskoffs
);
tokudb_
my_free
(
e
.
diskoffs
);
e
.
diskoffs
=
NULL
;
}
if
(
e
.
sizes
!=
NULL
)
{
my_free
(
e
.
sizes
);
tokudb_
my_free
(
e
.
sizes
);
e
.
sizes
=
NULL
;
}
return
error
;
...
...
@@ -1848,9 +1851,9 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
// set last_lock_timeout
if
(
lock_timeout_debug
&
1
)
{
char
*
old_lock_timeout
=
THDVAR
(
thd
,
last_lock_timeout
);
char
*
new_lock_timeout
=
my_strdup
(
log_str
.
c_ptr
(),
MY_FAE
);
char
*
new_lock_timeout
=
tokudb_
my_strdup
(
log_str
.
c_ptr
(),
MY_FAE
);
THDVAR
(
thd
,
last_lock_timeout
)
=
new_lock_timeout
;
my_free
(
old_lock_timeout
);
tokudb_
my_free
(
old_lock_timeout
);
}
// dump to stderr
if
(
lock_timeout_debug
&
2
)
{
...
...
storage/tokudb/tokudb_update_fun.cc
View file @
b8d7ee97
...
...
@@ -485,7 +485,7 @@ static int tokudb_hcad_update_fun(
extra_pos
+=
sizeof
(
uint32_t
);
max_num_bytes
=
old_val
->
size
+
extra
->
size
+
new_len_of_offsets
+
new_fixed_field_size
;
new_val_data
=
(
uchar
*
)
my_malloc
(
new_val_data
=
(
uchar
*
)
tokudb_
my_malloc
(
max_num_bytes
,
MYF
(
MY_FAE
)
);
...
...
@@ -815,7 +815,7 @@ static int tokudb_hcad_update_fun(
error
=
0
;
cleanup:
my_free
(
new_val_data
);
tokudb_
my_free
(
new_val_data
);
return
error
;
}
...
...
@@ -856,7 +856,7 @@ static int tokudb_expand_variable_offsets(
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
// allocate space for the new val's data
uchar
*
new_val_ptr
=
(
uchar
*
)
my_malloc
(
number_of_offsets
+
old_val
->
size
,
MYF
(
MY_FAE
));
uchar
*
new_val_ptr
=
(
uchar
*
)
tokudb_
my_malloc
(
number_of_offsets
+
old_val
->
size
,
MYF
(
MY_FAE
));
if
(
!
new_val_ptr
)
{
error
=
ENOMEM
;
goto
cleanup
;
...
...
@@ -893,7 +893,7 @@ static int tokudb_expand_variable_offsets(
error
=
0
;
cleanup:
my_free
(
new_val
.
data
);
tokudb_
my_free
(
new_val
.
data
);
return
error
;
}
...
...
@@ -932,7 +932,7 @@ static int tokudb_expand_int_field(
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
// allocate space for the new val's data
uchar
*
new_val_ptr
=
(
uchar
*
)
my_malloc
(
old_val
->
size
+
(
new_length
-
old_length
),
MYF
(
MY_FAE
));
uchar
*
new_val_ptr
=
(
uchar
*
)
tokudb_
my_malloc
(
old_val
->
size
+
(
new_length
-
old_length
),
MYF
(
MY_FAE
));
if
(
!
new_val_ptr
)
{
error
=
ENOMEM
;
goto
cleanup
;
...
...
@@ -980,7 +980,7 @@ static int tokudb_expand_int_field(
error
=
0
;
cleanup:
my_free
(
new_val
.
data
);
tokudb_
my_free
(
new_val
.
data
);
return
error
;
}
...
...
@@ -1021,7 +1021,7 @@ static int tokudb_expand_char_field(
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
// allocate space for the new val's data
uchar
*
new_val_ptr
=
(
uchar
*
)
my_malloc
(
old_val
->
size
+
(
new_length
-
old_length
),
MYF
(
MY_FAE
));
uchar
*
new_val_ptr
=
(
uchar
*
)
tokudb_
my_malloc
(
old_val
->
size
+
(
new_length
-
old_length
),
MYF
(
MY_FAE
));
if
(
!
new_val_ptr
)
{
error
=
ENOMEM
;
goto
cleanup
;
...
...
@@ -1062,7 +1062,7 @@ static int tokudb_expand_char_field(
error
=
0
;
cleanup:
my_free
(
new_val
.
data
);
tokudb_
my_free
(
new_val
.
data
);
return
error
;
}
...
...
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