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
bfed324b
Commit
bfed324b
authored
Jun 24, 2013
by
Zardosht Kasheff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs #42, exit gracefully from ha_tokudb::create if we notice a field that is invalid
parent
bc916eed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+18
-0
storage/tokudb/hatoku_cmp.cc
storage/tokudb/hatoku_cmp.cc
+55
-0
storage/tokudb/hatoku_cmp.h
storage/tokudb/hatoku_cmp.h
+2
-0
No files found.
storage/tokudb/ha_tokudb.cc
View file @
bfed324b
...
@@ -6960,6 +6960,24 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in
...
@@ -6960,6 +6960,24 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in
error
=
0
;
error
=
0
;
goto
cleanup
;
goto
cleanup
;
}
}
// validate the fields in the table. If the table has fields
// we do not support that came from an old version of MySQL,
// gracefully return an error
for
(
uint32_t
i
=
0
;
i
<
form
->
s
->
fields
;
i
++
)
{
Field
*
field
=
table_share
->
field
[
i
];
if
(
!
field_valid_for_tokudb_table
(
field
))
{
sql_print_error
(
"Table %s has an invalid field %s, that was created "
"with an old version of MySQL. This field is no longer supported. "
"This is probably due to an alter table engine=TokuDB. To load this "
"table, do a dump and load"
,
name
,
field
->
field_name
);
error
=
HA_ERR_UNSUPPORTED
;
goto
cleanup
;
}
}
newname
=
(
char
*
)
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
newname
=
(
char
*
)
my_malloc
(
get_max_dict_name_path_length
(
name
),
MYF
(
MY_WME
));
if
(
newname
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
if
(
newname
==
NULL
){
error
=
ENOMEM
;
goto
cleanup
;}
...
...
storage/tokudb/hatoku_cmp.cc
View file @
bfed324b
...
@@ -93,6 +93,61 @@ PATENT RIGHTS GRANT:
...
@@ -93,6 +93,61 @@ PATENT RIGHTS GRANT:
#error "WORDS_BIGENDIAN not supported"
#error "WORDS_BIGENDIAN not supported"
#endif
#endif
// returns true if the field is a valid field to be used
// in a TokuDB table. The non-valid fields are those
// that have been deprecated since before 5.1, and can
// only exist through upgrades of old versions of MySQL
bool
field_valid_for_tokudb_table
(
Field
*
field
)
{
bool
ret_val
=
false
;
enum_field_types
mysql_type
=
field
->
real_type
();
switch
(
mysql_type
)
{
case
MYSQL_TYPE_LONG
:
case
MYSQL_TYPE_LONGLONG
:
case
MYSQL_TYPE_TINY
:
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_INT24
:
case
MYSQL_TYPE_DATE
:
case
MYSQL_TYPE_YEAR
:
case
MYSQL_TYPE_NEWDATE
:
case
MYSQL_TYPE_ENUM
:
case
MYSQL_TYPE_SET
:
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_DATETIME
:
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_FLOAT
:
#if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
case
MYSQL_TYPE_DATETIME2
:
case
MYSQL_TYPE_TIMESTAMP2
:
case
MYSQL_TYPE_TIME2
:
#endif
case
MYSQL_TYPE_NEWDECIMAL
:
case
MYSQL_TYPE_BIT
:
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_VARCHAR
:
case
MYSQL_TYPE_TINY_BLOB
:
case
MYSQL_TYPE_MEDIUM_BLOB
:
case
MYSQL_TYPE_BLOB
:
case
MYSQL_TYPE_LONG_BLOB
:
ret_val
=
true
;
goto
exit
;
//
// I believe these are old types that are no longer
// in any 5.1 tables, so tokudb does not need
// to worry about them
// Putting in this assert in case I am wrong.
// Do not support geometry yet.
//
case
MYSQL_TYPE_GEOMETRY
:
case
MYSQL_TYPE_DECIMAL
:
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_NULL
:
ret_val
=
false
;
}
exit:
return
ret_val
;
}
void
get_var_field_info
(
void
get_var_field_info
(
uint32_t
*
field_len
,
// output: length of field
uint32_t
*
field_len
,
// output: length of field
uint32_t
*
start_offset
,
// output, length of offset where data starts
uint32_t
*
start_offset
,
// output, length of offset where data starts
...
...
storage/tokudb/hatoku_cmp.h
View file @
bfed324b
...
@@ -197,6 +197,8 @@ typedef struct st_key_and_col_info {
...
@@ -197,6 +197,8 @@ typedef struct st_key_and_col_info {
uint32_t
num_offset_bytes
;
//number of bytes needed to encode the offset
uint32_t
num_offset_bytes
;
//number of bytes needed to encode the offset
}
KEY_AND_COL_INFO
;
}
KEY_AND_COL_INFO
;
bool
field_valid_for_tokudb_table
(
Field
*
field
);
void
get_var_field_info
(
void
get_var_field_info
(
uint32_t
*
field_len
,
uint32_t
*
field_len
,
uint32_t
*
start_offset
,
uint32_t
*
start_offset
,
...
...
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