summaryrefslogtreecommitdiff
path: root/sql/handler.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/handler.h')
-rw-r--r--sql/handler.h91
1 files changed, 62 insertions, 29 deletions
diff --git a/sql/handler.h b/sql/handler.h
index cdab18cecbc..60c6195e68e 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -967,6 +967,7 @@ typedef struct xid_t XID;
*/
typedef uint Binlog_file_id;
const Binlog_file_id MAX_binlog_id= UINT_MAX;
+const my_off_t MAX_off_t = (~(my_off_t) 0);
/*
Compound binlog-id and byte offset of transaction's first event
in a sequence (e.g the recovery sequence) of binlog files.
@@ -981,14 +982,22 @@ struct xid_recovery_member
my_xid xid;
uint in_engine_prepare; // number of engines that have xid prepared
bool decided_to_commit;
- Binlog_offset binlog_coord; // semisync recovery binlog offset
+ /*
+ Semisync recovery binlog offset. It's initialized with the maximum
+ unreachable offset. The max value will remain for any transaction
+ not found in binlog to yield its rollback decision as it's guaranteed
+ to be within a truncated tail part of the binlog.
+ */
+ Binlog_offset binlog_coord;
XID *full_xid; // needed by wsrep or past it recovery
decltype(::server_id) server_id; // server id of orginal server
xid_recovery_member(my_xid xid_arg, uint prepare_arg, bool decided_arg,
XID *full_xid_arg, decltype(::server_id) server_id_arg)
: xid(xid_arg), in_engine_prepare(prepare_arg),
- decided_to_commit(decided_arg), full_xid(full_xid_arg) , server_id(server_id_arg) {};
+ decided_to_commit(decided_arg),
+ binlog_coord(Binlog_offset(MAX_binlog_id, MAX_off_t)),
+ full_xid(full_xid_arg), server_id(server_id_arg) {};
};
/* for recover() handlerton call */
@@ -2280,33 +2289,6 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
Schema_specification_st::init();
alter_info= NULL;
}
- bool check_conflicting_charset_declarations(CHARSET_INFO *cs);
- bool add_table_option_default_charset(CHARSET_INFO *cs)
- {
- // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
- if (check_conflicting_charset_declarations(cs))
- return true;
- default_table_charset= cs;
- used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
- return false;
- }
- bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs)
- {
- /*
- cs cannot be NULL, as sql_yacc.yy translates
- CONVERT TO CHARACTER SET DEFAULT
- to
- CONVERT TO CHARACTER SET <character-set-of-the-current-database>
- TODO: Shouldn't we postpone resolution of DEFAULT until the
- character set of the table owner database is loaded from its db.opt?
- */
- DBUG_ASSERT(cs);
- if (check_conflicting_charset_declarations(cs))
- return true;
- alter_table_convert_to_charset= default_table_charset= cs;
- used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
- return false;
- }
ulong table_options_with_row_type()
{
if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
@@ -2314,6 +2296,10 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
else
return table_options;
}
+ bool resolve_to_charset_collation_context(THD *thd,
+ const Lex_table_charset_collation_attrs_st &default_cscl,
+ const Lex_table_charset_collation_attrs_st &convert_cscl,
+ const Charset_collation_context &ctx);
};
@@ -2324,16 +2310,23 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
struct Table_specification_st: public HA_CREATE_INFO,
public DDL_options_st
{
+ Lex_table_charset_collation_attrs_st default_charset_collation;
+ Lex_table_charset_collation_attrs_st convert_charset_collation;
+
// Deep initialization
void init()
{
HA_CREATE_INFO::init();
DDL_options_st::init();
+ default_charset_collation.init();
+ convert_charset_collation.init();
}
void init(DDL_options_st::Options options_arg)
{
HA_CREATE_INFO::init();
DDL_options_st::init(options_arg);
+ default_charset_collation.init();
+ convert_charset_collation.init();
}
/*
Quick initialization, for parser.
@@ -2345,6 +2338,46 @@ struct Table_specification_st: public HA_CREATE_INFO,
{
HA_CREATE_INFO::options= 0;
DDL_options_st::init();
+ default_charset_collation.init();
+ convert_charset_collation.init();
+ }
+
+ bool add_table_option_convert_charset(CHARSET_INFO *cs)
+ {
+ // cs can be NULL, e.g.: ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT;
+ used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
+ return cs ?
+ convert_charset_collation.merge_exact_charset(Lex_exact_charset(cs)) :
+ convert_charset_collation.merge_charset_default();
+ }
+ bool add_table_option_convert_collation(const Lex_extended_collation_st &cl)
+ {
+ used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
+ return convert_charset_collation.merge_collation(cl);
+ }
+
+ bool add_table_option_default_charset(CHARSET_INFO *cs)
+ {
+ // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
+ used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
+ return cs ?
+ default_charset_collation.merge_exact_charset(Lex_exact_charset(cs)) :
+ default_charset_collation.merge_charset_default();
+ }
+ bool add_table_option_default_collation(const Lex_extended_collation_st &cl)
+ {
+ used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
+ return default_charset_collation.merge_collation(cl);
+ }
+
+ bool resolve_to_charset_collation_context(THD *thd,
+ const Charset_collation_context &ctx)
+ {
+ return HA_CREATE_INFO::
+ resolve_to_charset_collation_context(thd,
+ default_charset_collation,
+ convert_charset_collation,
+ ctx);
}
};