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
Expand all
Show 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
This diff is collapsed.
Click to expand it.
storage/tokudb/ha_tokudb_alter_56.cc
View file @
b8d7ee97
...
@@ -92,6 +92,8 @@ PATENT RIGHTS GRANT:
...
@@ -92,6 +92,8 @@ PATENT RIGHTS GRANT:
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099
#define TOKU_ALTER_RENAME ALTER_RENAME_56
#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
#elif 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
#define TOKU_ALTER_RENAME ALTER_RENAME
#define TOKU_ALTER_RENAME ALTER_RENAME
#elif 50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599
#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
...
@@ -492,7 +494,8 @@ bool ha_tokudb::inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha
if
(
error
==
0
&&
ctx
->
reset_card
)
if
(
error
==
0
&&
ctx
->
reset_card
)
tokudb
::
set_card_from_status
(
share
->
status_block
,
ctx
->
alter_txn
,
table
->
s
,
altered_table
->
s
);
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
))
{
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
);
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
...
@@ -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
)
{
int
ha_tokudb
::
alter_table_add_index
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
// sort keys in add index order
// 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
++
)
{
for
(
uint
i
=
0
;
i
<
ha_alter_info
->
index_add_count
;
i
++
)
{
KEY
*
key
=
&
key_info
[
i
];
KEY
*
key
=
&
key_info
[
i
];
*
key
=
ha_alter_info
->
key_info_buffer
[
ha_alter_info
->
index_add_buffer
[
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
...
@@ -529,7 +532,7 @@ int ha_tokudb::alter_table_add_index(TABLE *altered_table, Alter_inplace_info *h
last_dup_key
=
MAX_KEY
;
last_dup_key
=
MAX_KEY
;
}
}
my_free
(
key_info
);
tokudb_
my_free
(
key_info
);
if
(
error
==
0
)
if
(
error
==
0
)
ctx
->
reset_card
=
true
;
ctx
->
reset_card
=
true
;
...
@@ -619,7 +622,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
...
@@ -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
+
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
(
4
+
share
->
kc_info
.
num_blobs
)
+
// max static blob size
(
num_columns
*
(
1
+
4
+
1
+
4
));
// max dynamic 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
;
}
if
(
column_extra
==
NULL
)
{
error
=
ENOMEM
;
goto
cleanup
;
}
for
(
uint32_t
i
=
0
;
i
<
curr_num_DBs
;
i
++
)
{
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
...
@@ -629,7 +632,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
if
(
error
)
if
(
error
)
goto
cleanup
;
goto
cleanup
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
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
)
if
(
error
)
goto
cleanup
;
goto
cleanup
;
...
@@ -660,7 +663,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
...
@@ -660,7 +663,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
error
=
0
;
error
=
0
;
cleanup:
cleanup:
my_free
(
column_extra
);
tokudb_
my_free
(
column_extra
);
return
error
;
return
error
;
}
}
...
@@ -674,12 +677,13 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
...
@@ -674,12 +677,13 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
bool
result
=
false
;
// success
bool
result
=
false
;
// success
if
(
commit
)
{
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
)
{
if
(
ha_alter_info
->
group_commit_ctx
)
{
ha_alter_info
->
group_commit_ctx
=
NULL
;
ha_alter_info
->
group_commit_ctx
=
NULL
;
}
}
#endif
#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
)
{
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
);
int
error
=
write_frm_data
(
share
->
status_block
,
ctx
->
alter_txn
,
altered_table
->
s
->
path
.
str
);
if
(
error
)
{
if
(
error
)
{
...
@@ -753,7 +757,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
...
@@ -753,7 +757,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
if
(
error
)
if
(
error
)
break
;
break
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
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
)
if
(
error
)
break
;
break
;
...
@@ -766,7 +770,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
...
@@ -766,7 +770,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
// make the expand variable offsets message
// make the expand variable offsets message
DBT
expand
;
memset
(
&
expand
,
0
,
sizeof
expand
);
DBT
expand
;
memset
(
&
expand
,
0
,
sizeof
expand
);
expand
.
size
=
sizeof
(
uchar
)
+
sizeof
offset_start
+
sizeof
offset_end
;
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
)
{
if
(
!
expand
.
data
)
{
error
=
ENOMEM
;
error
=
ENOMEM
;
break
;
break
;
...
@@ -783,7 +787,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
...
@@ -783,7 +787,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
// and broadcast it into the tree
// 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
);
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
)
if
(
error
)
break
;
break
;
}
}
...
@@ -935,7 +939,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
...
@@ -935,7 +939,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
if
(
error
)
if
(
error
)
break
;
break
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
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
)
if
(
error
)
break
;
break
;
...
@@ -955,7 +959,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
...
@@ -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
;
expand
.
size
=
sizeof
operation
+
sizeof
new_offset
+
sizeof
old_length
+
sizeof
new_length
;
if
(
operation
==
UPDATE_OP_EXPAND_CHAR
||
operation
==
UPDATE_OP_EXPAND_BINARY
)
if
(
operation
==
UPDATE_OP_EXPAND_CHAR
||
operation
==
UPDATE_OP_EXPAND_BINARY
)
expand
.
size
+=
sizeof
pad_char
;
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
)
{
if
(
!
expand
.
data
)
{
error
=
ENOMEM
;
error
=
ENOMEM
;
break
;
break
;
...
@@ -984,7 +988,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
...
@@ -984,7 +988,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
// and broadcast it into the tree
// 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
);
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
)
if
(
error
)
break
;
break
;
}
}
...
@@ -1014,7 +1018,7 @@ int ha_tokudb::alter_table_expand_blobs(TABLE *altered_table, Alter_inplace_info
...
@@ -1014,7 +1018,7 @@ int ha_tokudb::alter_table_expand_blobs(TABLE *altered_table, Alter_inplace_info
if
(
error
)
if
(
error
)
break
;
break
;
error
=
share
->
key_file
[
i
]
->
change_descriptor
(
share
->
key_file
[
i
],
ctx
->
alter_txn
,
&
row_descriptor
,
0
);
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
)
if
(
error
)
break
;
break
;
...
@@ -1144,7 +1148,7 @@ int ha_tokudb::new_row_descriptor(TABLE *table, TABLE *altered_table, Alter_inpl
...
@@ -1144,7 +1148,7 @@ int ha_tokudb::new_row_descriptor(TABLE *table, TABLE *altered_table, Alter_inpl
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
);
row_descriptor
->
size
=
get_max_desc_size
(
ctx
->
altered_table_kc_info
,
altered_table
);
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
)
{
if
(
row_descriptor
->
data
==
NULL
)
{
error
=
ENOMEM
;
error
=
ENOMEM
;
}
else
{
}
else
{
...
...
storage/tokudb/hatoku_cmp.cc
View file @
b8d7ee97
...
@@ -117,7 +117,8 @@ bool field_valid_for_tokudb_table(Field* field) {
...
@@ -117,7 +117,8 @@ bool field_valid_for_tokudb_table(Field* field) {
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_FLOAT
:
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_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
case
MYSQL_TYPE_TIME2
:
...
@@ -264,7 +265,8 @@ TOKU_TYPE mysql_to_toku_type (Field* field) {
...
@@ -264,7 +265,8 @@ TOKU_TYPE mysql_to_toku_type (Field* field) {
case
MYSQL_TYPE_FLOAT
:
case
MYSQL_TYPE_FLOAT
:
ret_val
=
toku_type_float
;
ret_val
=
toku_type_float
;
goto
exit
;
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_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
case
MYSQL_TYPE_TIME2
:
...
@@ -3224,7 +3226,8 @@ bool fields_are_same_type(
...
@@ -3224,7 +3226,8 @@ bool fields_are_same_type(
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_TIMESTAMP
:
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_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
case
MYSQL_TYPE_TIME2
:
...
...
storage/tokudb/hatoku_cmp.h
View file @
b8d7ee97
...
@@ -263,7 +263,8 @@ static inline const uchar* unpack_toku_field_blob(
...
@@ -263,7 +263,8 @@ static inline const uchar* unpack_toku_field_blob(
}
}
static
inline
uint
get_null_offset
(
TABLE
*
table
,
Field
*
field
)
{
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
]);
return
field
->
null_offset
(
table
->
record
[
0
]);
#else
#else
return
(
uint
)
((
uchar
*
)
field
->
null_ptr
-
(
uchar
*
)
table
->
record
[
0
]);
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:
...
@@ -121,7 +121,13 @@ PATENT RIGHTS GRANT:
#if defined(TOKUDB_PATCHES) && TOKUDB_PATCHES == 0
#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
#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_ALTER_56 1
#define TOKU_INCLUDE_ROW_TYPE_COMPRESSION 1
#define TOKU_INCLUDE_ROW_TYPE_COMPRESSION 1
#define TOKU_INCLUDE_XA 1
#define TOKU_INCLUDE_XA 1
...
@@ -133,6 +139,7 @@ PATENT RIGHTS GRANT:
...
@@ -133,6 +139,7 @@ PATENT RIGHTS GRANT:
#endif
#endif
#elif 50500 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50599
#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_56 1
#define TOKU_INCLUDE_ALTER_55 1
#define TOKU_INCLUDE_ALTER_55 1
#define TOKU_INCLUDE_ROW_TYPE_COMPRESSION 1
#define TOKU_INCLUDE_ROW_TYPE_COMPRESSION 1
...
@@ -143,7 +150,6 @@ PATENT RIGHTS GRANT:
...
@@ -143,7 +150,6 @@ PATENT RIGHTS GRANT:
#if defined(MARIADB_BASE_VERSION)
#if defined(MARIADB_BASE_VERSION)
#define TOKU_INCLUDE_EXTENDED_KEYS 1
#define TOKU_INCLUDE_EXTENDED_KEYS 1
#endif
#endif
#define TOKU_INCLUDE_OTHER_DB_TYPE 1
#define TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL 1
#define TOKU_INCLUDE_HANDLERTON_HANDLE_FATAL_SIGNAL 1
#else
#else
...
@@ -354,4 +360,60 @@ void toku_hton_assert_fail(const char*/*expr_as_string*/,const char */*fun*/,con
...
@@ -354,4 +360,60 @@ void toku_hton_assert_fail(const char*/*expr_as_string*/,const char */*fun*/,con
#undef assert
#undef assert
#define assert(expr) ((expr) ? (void)0 : toku_hton_assert_fail(#expr, __FUNCTION__, __FILE__, __LINE__, errno))
#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
#endif
storage/tokudb/hatoku_hton.cc
View file @
b8d7ee97
...
@@ -315,7 +315,7 @@ static int tokudb_init_func(void *p) {
...
@@ -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_CAN_RECREATE; // QQQ this came from skeleton
tokudb_hton
->
flags
=
HTON_CLOSE_CURSORS_AT_COMMIT
;
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)
#if defined(HTON_SUPPORTS_EXTENDED_KEYS)
tokudb_hton
->
flags
|=
HTON_SUPPORTS_EXTENDED_KEYS
;
tokudb_hton
->
flags
|=
HTON_SUPPORTS_EXTENDED_KEYS
;
#endif
#endif
...
@@ -324,13 +324,16 @@ static int tokudb_init_func(void *p) {
...
@@ -324,13 +324,16 @@ static int tokudb_init_func(void *p) {
#endif
#endif
#endif
#endif
#if TOKU_INCLUDE_OTHER_DB_TYPE
#if defined(TOKU_USE_DB_TYPE_TOKUDB) && TOKU_USE_DB_TYPE_TOKUDB
// we have historically been a dynamic storage engine, so we set db_type according.
tokudb_hton
->
db_type
=
DB_TYPE_TOKUDB
;
// however, extended keys is triggered off of the db_type, so tokudb adds another type so that extended keys works
#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
->
db_type
=
DB_TYPE_UNKNOWN
;
tokudb_hton
->
other_db_type
=
DB_TYPE_TOKUDB
;
tokudb_hton
->
other_db_type
=
DB_TYPE_TOKUDB
;
#else
#else
tokudb_hton
->
db_type
=
DB_TYPE_TOKUDB
;
#error
#endif
#endif
tokudb_hton
->
create
=
tokudb_create_handler
;
tokudb_hton
->
create
=
tokudb_create_handler
;
...
@@ -491,8 +494,8 @@ static int tokudb_init_func(void *p) {
...
@@ -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
;
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_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
*
)
my_malloc
(
sizeof
(
*
toku_global_status_rows
)
*
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
);
r
=
db_create
(
&
metadata_db
,
db_env
,
0
);
...
@@ -550,9 +553,9 @@ error:
...
@@ -550,9 +553,9 @@ 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_done_func"
);
my_free
(
toku_global_status_variables
);
tokudb_
my_free
(
toku_global_status_variables
);
toku_global_status_variables
=
NULL
;
toku_global_status_variables
=
NULL
;
my_free
(
toku_global_status_rows
);
tokudb_
my_free
(
toku_global_status_rows
);
toku_global_status_rows
=
NULL
;
toku_global_status_rows
=
NULL
;
my_hash_free
(
&
tokudb_open_tables
);
my_hash_free
(
&
tokudb_open_tables
);
pthread_mutex_destroy
(
&
tokudb_mutex
);
pthread_mutex_destroy
(
&
tokudb_mutex
);
...
@@ -604,7 +607,7 @@ static int tokudb_close_connection(handlerton * hton, THD * thd) {
...
@@ -604,7 +607,7 @@ static int tokudb_close_connection(handlerton * hton, THD * thd) {
if
(
trx
&&
trx
->
checkpoint_lock_taken
)
{
if
(
trx
&&
trx
->
checkpoint_lock_taken
)
{
error
=
db_env
->
checkpointing_resume
(
db_env
);
error
=
db_env
->
checkpointing_resume
(
db_env
);
}
}
my_free
(
trx
);
tokudb_
my_free
(
trx
);
return
error
;
return
error
;
}
}
...
@@ -1595,10 +1598,10 @@ static int tokudb_report_fractal_tree_block_map_iterator(uint64_t checkpoint_cou
...
@@ -1595,10 +1598,10 @@ static int tokudb_report_fractal_tree_block_map_iterator(uint64_t checkpoint_cou
assert
(
num_rows
>
0
);
assert
(
num_rows
>
0
);
if
(
e
->
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
->
checkpoint_counts
=
(
uint64_t
*
)
tokudb_
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
->
blocknums
=
(
int64_t
*
)
tokudb_
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
->
diskoffs
=
(
int64_t
*
)
tokudb_
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
->
sizes
=
(
int64_t
*
)
tokudb_
my_malloc
(
num_rows
*
(
sizeof
*
e
->
sizes
),
MYF
(
MY_WME
|
MY_ZEROFILL
|
MY_FAE
));
e
->
num_rows
=
num_rows
;
e
->
num_rows
=
num_rows
;
}
}
...
@@ -1678,19 +1681,19 @@ static int tokudb_report_fractal_tree_block_map_for_db(const DBT *dname, const D
...
@@ -1678,19 +1681,19 @@ static int tokudb_report_fractal_tree_block_map_for_db(const DBT *dname, const D
exit:
exit:
if
(
e
.
checkpoint_counts
!=
NULL
)
{
if
(
e
.
checkpoint_counts
!=
NULL
)
{
my_free
(
e
.
checkpoint_counts
);
tokudb_
my_free
(
e
.
checkpoint_counts
);
e
.
checkpoint_counts
=
NULL
;
e
.
checkpoint_counts
=
NULL
;
}
}
if
(
e
.
blocknums
!=
NULL
)
{
if
(
e
.
blocknums
!=
NULL
)
{
my_free
(
e
.
blocknums
);
tokudb_
my_free
(
e
.
blocknums
);
e
.
blocknums
=
NULL
;
e
.
blocknums
=
NULL
;
}
}
if
(
e
.
diskoffs
!=
NULL
)
{
if
(
e
.
diskoffs
!=
NULL
)
{
my_free
(
e
.
diskoffs
);
tokudb_
my_free
(
e
.
diskoffs
);
e
.
diskoffs
=
NULL
;
e
.
diskoffs
=
NULL
;
}
}
if
(
e
.
sizes
!=
NULL
)
{
if
(
e
.
sizes
!=
NULL
)
{
my_free
(
e
.
sizes
);
tokudb_
my_free
(
e
.
sizes
);
e
.
sizes
=
NULL
;
e
.
sizes
=
NULL
;
}
}
return
error
;
return
error
;
...
@@ -1848,9 +1851,9 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
...
@@ -1848,9 +1851,9 @@ static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, cons
// set last_lock_timeout
// set last_lock_timeout
if
(
lock_timeout_debug
&
1
)
{
if
(
lock_timeout_debug
&
1
)
{
char
*
old_lock_timeout
=
THDVAR
(
thd
,
last_lock_timeout
);
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
;
THDVAR
(
thd
,
last_lock_timeout
)
=
new_lock_timeout
;
my_free
(
old_lock_timeout
);
tokudb_
my_free
(
old_lock_timeout
);
}
}
// dump to stderr
// dump to stderr
if
(
lock_timeout_debug
&
2
)
{
if
(
lock_timeout_debug
&
2
)
{
...
...
storage/tokudb/tokudb_update_fun.cc
View file @
b8d7ee97
...
@@ -485,7 +485,7 @@ static int tokudb_hcad_update_fun(
...
@@ -485,7 +485,7 @@ static int tokudb_hcad_update_fun(
extra_pos
+=
sizeof
(
uint32_t
);
extra_pos
+=
sizeof
(
uint32_t
);
max_num_bytes
=
old_val
->
size
+
extra
->
size
+
new_len_of_offsets
+
new_fixed_field_size
;
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
,
max_num_bytes
,
MYF
(
MY_FAE
)
MYF
(
MY_FAE
)
);
);
...
@@ -815,7 +815,7 @@ static int tokudb_hcad_update_fun(
...
@@ -815,7 +815,7 @@ static int tokudb_hcad_update_fun(
error
=
0
;
error
=
0
;
cleanup:
cleanup:
my_free
(
new_val_data
);
tokudb_
my_free
(
new_val_data
);
return
error
;
return
error
;
}
}
...
@@ -856,7 +856,7 @@ static int tokudb_expand_variable_offsets(
...
@@ -856,7 +856,7 @@ static int tokudb_expand_variable_offsets(
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
// allocate space for the new val's 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
)
{
if
(
!
new_val_ptr
)
{
error
=
ENOMEM
;
error
=
ENOMEM
;
goto
cleanup
;
goto
cleanup
;
...
@@ -893,7 +893,7 @@ static int tokudb_expand_variable_offsets(
...
@@ -893,7 +893,7 @@ static int tokudb_expand_variable_offsets(
error
=
0
;
error
=
0
;
cleanup:
cleanup:
my_free
(
new_val
.
data
);
tokudb_
my_free
(
new_val
.
data
);
return
error
;
return
error
;
}
}
...
@@ -932,7 +932,7 @@ static int tokudb_expand_int_field(
...
@@ -932,7 +932,7 @@ static int tokudb_expand_int_field(
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
// allocate space for the new val's 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
)
{
if
(
!
new_val_ptr
)
{
error
=
ENOMEM
;
error
=
ENOMEM
;
goto
cleanup
;
goto
cleanup
;
...
@@ -980,7 +980,7 @@ static int tokudb_expand_int_field(
...
@@ -980,7 +980,7 @@ static int tokudb_expand_int_field(
error
=
0
;
error
=
0
;
cleanup:
cleanup:
my_free
(
new_val
.
data
);
tokudb_
my_free
(
new_val
.
data
);
return
error
;
return
error
;
}
}
...
@@ -1021,7 +1021,7 @@ static int tokudb_expand_char_field(
...
@@ -1021,7 +1021,7 @@ static int tokudb_expand_char_field(
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
uchar
*
old_val_ptr
=
(
uchar
*
)
old_val
->
data
;
// allocate space for the new val's 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
)
{
if
(
!
new_val_ptr
)
{
error
=
ENOMEM
;
error
=
ENOMEM
;
goto
cleanup
;
goto
cleanup
;
...
@@ -1062,7 +1062,7 @@ static int tokudb_expand_char_field(
...
@@ -1062,7 +1062,7 @@ static int tokudb_expand_char_field(
error
=
0
;
error
=
0
;
cleanup:
cleanup:
my_free
(
new_val
.
data
);
tokudb_
my_free
(
new_val
.
data
);
return
error
;
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