summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2020-07-27 18:46:37 +0300
committerOleksandr Byelkin <sanja@mariadb.com>2020-08-04 17:27:32 +0200
commit58e759a9393f76e558c016a3f84656401b9de1ce (patch)
tree10b2fe07a91372850d00d2c405b95c0ae240833c
parent48b5777ebda9bf14c60ad05298dac67933e9799f (diff)
downloadmariadb-git-58e759a9393f76e558c016a3f84656401b9de1ce.tar.gz
Added 'final' to some classes to improve generated code
Final added to: - All reasonable classes inhereted from Field - All classes inhereted from Protocol - Almost all Handler classes - Some important Item classes The stripped size of mariadbd is just 4K smaller, but several object files showed notable improvements in common execution paths. - Checked field.o and item_sum.o Other things: - Added 'override' to a few class functions touched by this patch. - Removed 'virtual' from a new class functions that had/got 'override' - Changed Protocol_discard to inherit from Protocol instad of Protocol_text
-rw-r--r--sql/field.h147
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_cmpfunc.h6
-rw-r--r--sql/item_sum.h28
-rw-r--r--sql/protocol.h52
-rw-r--r--storage/archive/ha_archive.h2
-rw-r--r--storage/blackhole/ha_blackhole.h2
-rw-r--r--storage/connect/ha_connect.h2
-rw-r--r--storage/csv/ha_tina.h2
-rw-r--r--storage/federatedx/ha_federatedx.h2
-rw-r--r--storage/heap/ha_heap.h2
-rw-r--r--storage/innobase/handler/ha_innodb.h2
-rw-r--r--storage/maria/ha_maria.h151
-rw-r--r--storage/maria/ha_s3.h32
-rw-r--r--storage/myisam/ha_myisam.h2
-rw-r--r--storage/myisammrg/ha_myisammrg.h2
-rw-r--r--storage/perfschema/ha_perfschema.h2
-rw-r--r--storage/sequence/sequence.cc2
-rw-r--r--storage/sphinx/ha_sphinx.h2
-rw-r--r--storage/spider/ha_spider.h2
20 files changed, 228 insertions, 216 deletions
diff --git a/sql/field.h b/sql/field.h
index 8a5e84edaa1..0f531564116 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -2274,7 +2274,7 @@ public:
};
-class Field_decimal :public Field_real {
+class Field_decimal final :public Field_real {
public:
Field_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2320,7 +2320,7 @@ public:
/* New decimal/numeric field which use fixed point arithmetic */
-class Field_new_decimal :public Field_num {
+class Field_new_decimal final :public Field_num {
public:
/* The maximum number of decimal digits can be stored */
uint precision;
@@ -2550,7 +2550,7 @@ public:
};
-class Field_short :public Field_int
+class Field_short final :public Field_int
{
const Type_handler_general_purpose_int *type_handler_priv() const
{
@@ -2603,7 +2603,7 @@ public:
}
};
-class Field_medium :public Field_int
+class Field_medium final :public Field_int
{
const Type_handler_general_purpose_int *type_handler_priv() const
{
@@ -2649,7 +2649,7 @@ public:
};
-class Field_long :public Field_int
+class Field_long final :public Field_int
{
const Type_handler_general_purpose_int *type_handler_priv() const
{
@@ -2812,7 +2812,7 @@ public:
};
-class Field_float :public Field_real {
+class Field_float final :public Field_real {
public:
Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -2898,28 +2898,28 @@ public:
}
const Type_handler *type_handler() const override
{ return &type_handler_double; }
- enum ha_base_keytype key_type() const override { return HA_KEYTYPE_DOUBLE; }
- int store(const char *to,size_t length,CHARSET_INFO *charset) override;
- int store(double nr) override;
- int store(longlong nr, bool unsigned_val) override;
- int reset() override { bzero(ptr,sizeof(double)); return 0; }
- double val_real() override;
- longlong val_int() override { return val_int_from_real(false); }
- ulonglong val_uint() override { return (ulonglong) val_int_from_real(true); }
- String *val_str(String *, String *) override;
- bool send_binary(Protocol *protocol) override;
- int cmp(const uchar *,const uchar *) const override;
- void sort_string(uchar *buff, uint length) override;
- uint32 pack_length() const override { return sizeof(double); }
- uint row_pack_length() const override { return pack_length(); }
- ulonglong get_max_int_value() const override
+ enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_DOUBLE; }
+ int store(const char *to,size_t length,CHARSET_INFO *charset) override final;
+ int store(double nr) override final;
+ int store(longlong nr, bool unsigned_val) override final;
+ int reset() override final { bzero(ptr,sizeof(double)); return 0; }
+ double val_real() override final;
+ longlong val_int() override final { return val_int_from_real(false); }
+ ulonglong val_uint() override final { return (ulonglong) val_int_from_real(true); }
+ String *val_str(String *, String *) override final;
+ bool send_binary(Protocol *protocol) override final;
+ int cmp(const uchar *,const uchar *) const override final;
+ void sort_string(uchar *buff, uint length) override final;
+ uint32 pack_length() const override final { return sizeof(double); }
+ uint row_pack_length() const override final { return pack_length(); }
+ ulonglong get_max_int_value() const override final
{
/*
We use the maximum as per IEEE754-2008 standard, 2^53
*/
return 0x20000000000000ULL;
}
- Binlog_type_info binlog_type_info() const override;
+ Binlog_type_info binlog_type_info() const override final;
};
@@ -2948,40 +2948,40 @@ public:
{
return do_field_string;
}
- int store(const char *to, size_t length, CHARSET_INFO *cs) override
+ int store(const char *to, size_t length, CHARSET_INFO *cs) override final
{ null[0]=1; return 0; }
- int store(double nr) override { null[0]=1; return 0; }
- int store(longlong nr, bool unsigned_val) override { null[0]=1; return 0; }
- int store_decimal(const my_decimal *d) override { null[0]=1; return 0; }
- int reset() override { return 0; }
- double val_real() override { return 0.0;}
- longlong val_int() override { return 0;}
- bool val_bool() override { return false; }
- my_decimal *val_decimal(my_decimal *) override { return 0; }
- String *val_str(String *value,String *value2) override
+ int store(double nr) override final { null[0]=1; return 0; }
+ int store(longlong nr, bool unsigned_val) override final { null[0]=1; return 0; }
+ int store_decimal(const my_decimal *d) override final { null[0]=1; return 0; }
+ int reset() override final { return 0; }
+ double val_real() override final { return 0.0;}
+ longlong val_int() override final { return 0;}
+ bool val_bool() override final { return false; }
+ my_decimal *val_decimal(my_decimal *) override final { return 0; }
+ String *val_str(String *value,String *value2) override final
{ value2->length(0); return value2;}
- bool is_equal(const Column_definition &new_field) const override;
- int cmp(const uchar *a, const uchar *b) const override { return 0;}
- void sort_string(uchar *buff, uint length) override {}
- uint32 pack_length() const override { return 0; }
- void sql_type(String &str) const override;
- uint size_of() const override { return sizeof *this; }
- uint32 max_display_length() const override { return 4; }
- void move_field_offset(my_ptrdiff_t ptr_diff) override {}
+ bool is_equal(const Column_definition &new_field) const override final;
+ int cmp(const uchar *a, const uchar *b) const override final { return 0;}
+ void sort_string(uchar *buff, uint length) override final {}
+ uint32 pack_length() const override final { return 0; }
+ void sql_type(String &str) const override final;
+ uint size_of() const override final { return sizeof *this; }
+ uint32 max_display_length() const override final { return 4; }
+ void move_field_offset(my_ptrdiff_t ptr_diff) override final {}
bool can_optimize_keypart_ref(const Item_bool_func *cond,
- const Item *item) const override
+ const Item *item) const override final
{
return false;
}
bool can_optimize_group_min_max(const Item_bool_func *cond,
- const Item *const_item) const override
+ const Item *const_item) const override final
{
return false;
}
};
-class Field_temporal: public Field {
+class Field_temporal :public Field {
protected:
Item *get_equal_const_item_datetime(THD *thd, const Context &ctx,
Item *const_item);
@@ -3098,7 +3098,7 @@ public:
- DATETIME(1..6)
- DATETIME(0..6) - MySQL56 version
*/
-class Field_temporal_with_date: public Field_temporal {
+class Field_temporal_with_date :public Field_temporal {
protected:
virtual void store_TIME(const MYSQL_TIME *ltime) = 0;
void store_datetime(const Datetime &dt)
@@ -3305,7 +3305,7 @@ public:
/**
TIMESTAMP(0..6) - MySQL56 version
*/
-class Field_timestampf :public Field_timestamp_with_dec {
+class Field_timestampf final :public Field_timestamp_with_dec {
void store_TIMEVAL(const timeval &tv) override;
public:
Field_timestampf(uchar *ptr_arg,
@@ -3353,7 +3353,7 @@ public:
};
-class Field_year :public Field_tiny {
+class Field_year final :public Field_tiny {
public:
Field_year(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -3414,7 +3414,7 @@ public:
};
-class Field_date_common: public Field_temporal_with_date
+class Field_date_common :public Field_temporal_with_date
{
protected:
int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str,
@@ -3439,7 +3439,7 @@ public:
};
-class Field_date :public Field_date_common
+class Field_date final :public Field_date_common
{
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
@@ -3480,7 +3480,7 @@ public:
};
-class Field_newdate :public Field_date_common
+class Field_newdate final :public Field_date_common
{
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
@@ -3571,7 +3571,7 @@ public:
};
-class Field_time0: public Field_time
+class Field_time0 final :public Field_time
{
protected:
void store_TIME(const MYSQL_TIME *ltime) override;
@@ -3628,7 +3628,7 @@ public:
/**
TIME(1..6)
*/
-class Field_time_hires :public Field_time_with_dec {
+class Field_time_hires final :public Field_time_with_dec {
longlong zero_point;
void store_TIME(const MYSQL_TIME *) override;
public:
@@ -3661,7 +3661,7 @@ public:
/**
TIME(0..6) - MySQL56 version
*/
-class Field_timef :public Field_time_with_dec {
+class Field_timef final :public Field_time_with_dec {
void store_TIME(const MYSQL_TIME *ltime) override;
public:
Field_timef(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
@@ -3746,7 +3746,11 @@ public:
};
-class Field_datetime0 :public Field_datetime
+/*
+ Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte
+*/
+
+class Field_datetime0 final :public Field_datetime
{
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
@@ -3808,30 +3812,30 @@ public:
{
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
}
- uint decimals() const override { return dec; }
- enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; }
- void make_send_field(Send_field *field) override;
- bool send_binary(Protocol *protocol) override;
- uchar *pack(uchar *to, const uchar *from, uint max_length) override
+ uint decimals() const override final { return dec; }
+ enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_BINARY; }
+ void make_send_field(Send_field *field) override final;
+ bool send_binary(Protocol *protocol) override final;
+ uchar *pack(uchar *to, const uchar *from, uint max_length) override final
{ return Field::pack(to, from, max_length); }
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
- uint param_data) override
+ uint param_data) override final
{ return Field::unpack(to, from, from_end, param_data); }
- void sort_string(uchar *to, uint length) override
+ void sort_string(uchar *to, uint length) override final
{
DBUG_ASSERT(length == pack_length());
memcpy(to, ptr, length);
}
- double val_real() override;
- longlong val_int() override;
- String *val_str(String *, String *) override;
+ double val_real() override final;
+ longlong val_int() override final;
+ String *val_str(String *, String *) override final;
};
/**
DATETIME(1..6)
*/
-class Field_datetime_hires :public Field_datetime_with_dec {
+class Field_datetime_hires final :public Field_datetime_with_dec {
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
const override;
@@ -3861,7 +3865,8 @@ public:
/**
DATETIME(0..6) - MySQL56 version
*/
-class Field_datetimef :public Field_datetime_with_dec {
+
+class Field_datetimef final :public Field_datetime_with_dec {
void store_TIME(const MYSQL_TIME *ltime) override;
bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate)
const override;
@@ -3955,7 +3960,7 @@ new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
unireg_check, field_name, dec);
}
-class Field_string :public Field_longstr {
+class Field_string final :public Field_longstr {
class Warn_filter_string: public Warn_filter
{
public:
@@ -4188,7 +4193,7 @@ public:
};
-class Field_varstring_compressed: public Field_varstring {
+class Field_varstring_compressed final :public Field_varstring {
public:
Field_varstring_compressed(uchar *ptr_arg,
uint32 len_arg, uint length_bytes_arg,
@@ -4590,7 +4595,7 @@ public:
};
-class Field_blob_compressed: public Field_blob {
+class Field_blob_compressed final :public Field_blob {
public:
Field_blob_compressed(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg,
@@ -4756,7 +4761,7 @@ private:
};
-class Field_set :public Field_enum {
+class Field_set final :public Field_enum {
public:
Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -5005,7 +5010,7 @@ private:
an extended version of Field_bit_as_char and not the other way
around. Hence, we should refactor it to fix the hierarchy order.
*/
-class Field_bit_as_char: public Field_bit {
+class Field_bit_as_char final :public Field_bit {
public:
Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
@@ -5020,7 +5025,7 @@ public:
};
-class Field_row: public Field_null
+class Field_row final :public Field_null
{
class Virtual_tmp_table *m_table;
public:
diff --git a/sql/item.cc b/sql/item.cc
index f534a2c182b..c1d51903f6b 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2157,7 +2157,7 @@ public:
const LEX_CSTRING &field_name_arg):
Item_ref(thd, context_arg, item, table_name_arg, field_name_arg) {}
- virtual inline void print (String *str, enum_query_type query_type)
+ void print (String *str, enum_query_type query_type) override
{
if (ref)
(*ref)->print(str, query_type);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 23d04a57580..40728f244f3 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -744,7 +744,7 @@ public:
{ return get_item_copy<Item_func_eq>(thd, this); }
};
-class Item_func_equal :public Item_bool_rowready_func2
+class Item_func_equal final :public Item_bool_rowready_func2
{
public:
Item_func_equal(THD *thd, Item *a, Item *b):
@@ -3331,7 +3331,7 @@ public:
};
-class Item_cond_and :public Item_cond
+class Item_cond_and final :public Item_cond
{
public:
COND_EQUAL m_cond_equal; /* contains list of Item_equal objects for
@@ -3368,7 +3368,7 @@ inline bool is_cond_and(Item *item)
return func_item && func_item->functype() == Item_func::COND_AND_FUNC;
}
-class Item_cond_or :public Item_cond
+class Item_cond_or final :public Item_cond
{
public:
Item_cond_or(THD *thd): Item_cond(thd) {}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 7dd4d0bd391..961cb884c4f 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1016,7 +1016,7 @@ public:
-class Item_sum_variance : public Item_sum_double
+class Item_sum_variance :public Item_sum_double
{
Stddev m_stddev;
bool fix_length_and_dec();
@@ -1033,13 +1033,13 @@ public:
enum Sumfunctype sum_func () const { return VARIANCE_FUNC; }
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
- void clear();
- bool add();
+ void clear() override final;
+ bool add() override final;
double val_real();
- void reset_field();
- void update_field();
+ void reset_field() override final;
+ void update_field() override final;
Item *result_item(THD *thd, Field *field);
- void no_rows_in_result() {}
+ void no_rows_in_result() override final {}
const char *func_name() const
{ return sample ? "var_samp(" : "variance("; }
Item *copy_or_same(THD* thd);
@@ -1057,7 +1057,7 @@ public:
standard_deviation(a) = sqrt(variance(a))
*/
-class Item_sum_std :public Item_sum_variance
+class Item_sum_std final :public Item_sum_variance
{
public:
Item_sum_std(THD *thd, Item *item_par, uint sample_arg):
@@ -1075,7 +1075,7 @@ class Item_sum_std :public Item_sum_variance
};
-class Item_sum_hybrid: public Item_sum,
+class Item_sum_hybrid : public Item_sum,
public Type_handler_hybrid_field_type
{
public:
@@ -1156,7 +1156,7 @@ public:
};
-class Item_sum_min :public Item_sum_min_max
+class Item_sum_min final :public Item_sum_min_max
{
public:
Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {}
@@ -1171,7 +1171,7 @@ public:
};
-class Item_sum_max :public Item_sum_min_max
+class Item_sum_max final :public Item_sum_min_max
{
public:
Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {}
@@ -1260,7 +1260,7 @@ protected:
};
-class Item_sum_or :public Item_sum_bit
+class Item_sum_or final :public Item_sum_bit
{
public:
Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
@@ -1276,7 +1276,7 @@ private:
};
-class Item_sum_and :public Item_sum_bit
+class Item_sum_and final :public Item_sum_bit
{
public:
Item_sum_and(THD *thd, Item *item_par):
@@ -1292,7 +1292,7 @@ private:
void set_bits_from_counters();
};
-class Item_sum_xor :public Item_sum_bit
+class Item_sum_xor final :public Item_sum_bit
{
public:
Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
@@ -1359,7 +1359,7 @@ struct st_sp_security_context;
Example:
DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN ret_val;
*/
-class Item_sum_sp :public Item_sum,
+class Item_sum_sp final :public Item_sum,
public Item_sp
{
private:
diff --git a/sql/protocol.h b/sql/protocol.h
index 18a01255708..8464b7f530b 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -190,7 +190,8 @@ public:
Before adding a new type, please make sure
there is enough storage for it in Query_cache_query_flags.
*/
- PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1, PROTOCOL_LOCAL= 2
+ PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1, PROTOCOL_LOCAL= 2,
+ PROTOCOL_DISCARD= 3 /* Should be last, not used by Query_cache */
};
virtual enum enum_protocol_type type()= 0;
@@ -204,7 +205,7 @@ public:
/** Class used for the old (MySQL 4.0 protocol). */
-class Protocol_text :public Protocol
+class Protocol_text final :public Protocol
{
public:
Protocol_text(THD *thd_arg, ulong prealloc= 0)
@@ -242,11 +243,11 @@ public:
bool store_field_metadata_for_list_fields(const THD *thd, Field *field,
const TABLE_LIST *table_list,
uint pos);
- virtual enum enum_protocol_type type() { return PROTOCOL_TEXT; };
+ enum enum_protocol_type type() override { return PROTOCOL_TEXT; };
};
-class Protocol_binary :public Protocol
+class Protocol_binary final :public Protocol
{
private:
uint bit_fields;
@@ -279,7 +280,7 @@ public:
virtual bool send_out_parameters(List<Item_param> *sp_params);
- virtual enum enum_protocol_type type() { return PROTOCOL_BINARY; };
+ enum enum_protocol_type type() override { return PROTOCOL_BINARY; };
};
@@ -297,37 +298,38 @@ public:
select_send::send_data() & co., and also uses Protocol_discard object.
*/
-class Protocol_discard : public Protocol_text
+class Protocol_discard final : public Protocol
{
public:
- Protocol_discard(THD *thd_arg) : Protocol_text(thd_arg) {}
- bool write() { return 0; }
- bool send_result_set_metadata(List<Item> *, uint) { return 0; }
- bool send_eof(uint, uint) { return 0; }
- void prepare_for_resend() { IF_DBUG(field_pos= 0,); }
+ Protocol_discard(THD *thd_arg) : Protocol(thd_arg) {}
+ bool write() override { return 0; }
+ bool send_result_set_metadata(List<Item> *, uint) override { return 0; }
+ bool send_eof(uint, uint) override { return 0; }
+ void prepare_for_resend() override { IF_DBUG(field_pos= 0,); }
+ bool send_out_parameters(List<Item_param> *sp_params) override { return false; }
/*
Provide dummy overrides for any storage methods so that we
avoid allocating and copying of data
*/
- bool store_null() { return false; }
- bool store_tiny(longlong) { return false; }
- bool store_short(longlong) { return false; }
- bool store_long(longlong) { return false; }
- bool store_longlong(longlong, bool) { return false; }
- bool store_decimal(const my_decimal *) { return false; }
+ bool store_null() override { return false; }
+ bool store_tiny(longlong) override { return false; }
+ bool store_short(longlong) override { return false; }
+ bool store_long(longlong) override { return false; }
+ bool store_longlong(longlong, bool) override { return false; }
+ bool store_decimal(const my_decimal *) override { return false; }
bool store_str(const char *, size_t, CHARSET_INFO *, my_repertoire_t,
- CHARSET_INFO *)
+ CHARSET_INFO *) override
{
return false;
}
- bool store(MYSQL_TIME *, int) { return false; }
- bool store_date(MYSQL_TIME *) { return false; }
- bool store_time(MYSQL_TIME *, int) { return false; }
- bool store(float, uint32, String *) { return false; }
- bool store(double, uint32, String *) { return false; }
- bool store(Field *) { return false; }
-
+ bool store(MYSQL_TIME *, int) override { return false; }
+ bool store_date(MYSQL_TIME *) override { return false; }
+ bool store_time(MYSQL_TIME *, int) override { return false; }
+ bool store(float, uint32, String *) override { return false; }
+ bool store(double, uint32, String *) override { return false; }
+ bool store(Field *) override { return false; }
+ enum enum_protocol_type type() override { return PROTOCOL_DISCARD; };
};
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index b9fcf10f96f..c1b4f27e45e 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -73,7 +73,7 @@ public:
*/
#define ARCHIVE_VERSION 3
-class ha_archive: public handler
+class ha_archive final : public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
Archive_share *share; /* Shared lock info */
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index 646fba6da9f..c2a36a68f45 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -36,7 +36,7 @@ struct st_blackhole_share {
Class definition for the blackhole storage engine
"Dumbest named feature ever"
*/
-class ha_blackhole: public handler
+class ha_blackhole final : public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
st_blackhole_share *share;
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index 09e8c42b443..8be1fe262b6 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -144,7 +144,7 @@ typedef class ha_connect *PHC;
/** @brief
Class definition for the storage engine
*/
-class ha_connect: public handler
+class ha_connect final : public handler
{
THR_LOCK_DATA lock; ///< MySQL lock
CONNECT_SHARE *share; ///< Shared lock info
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index aae535c271e..043183444da 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -57,7 +57,7 @@ struct tina_set {
my_off_t end;
};
-class ha_tina: public handler
+class ha_tina final : public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
TINA_SHARE *share; /* Shared lock info */
diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h
index 67fe5f8cc22..333028da587 100644
--- a/storage/federatedx/ha_federatedx.h
+++ b/storage/federatedx/ha_federatedx.h
@@ -260,7 +260,7 @@ public:
/*
Class definition for the storage engine
*/
-class ha_federatedx: public handler
+class ha_federatedx final : public handler
{
friend int federatedx_db_init(void *p);
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index 50d3c0afb6c..3a41028c719 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -25,7 +25,7 @@
#include <heap.h>
#include "sql_class.h" /* THD */
-class ha_heap: public handler
+class ha_heap final : public handler
{
HP_INFO *file;
HP_SHARE *internal_share;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 499b250d880..fc4b2cf84ac 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -58,7 +58,7 @@ struct st_handler_tablename
const char *tablename;
};
/** The class defining a handle to an Innodb table */
-class ha_innobase final: public handler
+class ha_innobase final : public handler
{
public:
ha_innobase(handlerton* hton, TABLE_SHARE* table_arg);
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index ddf8fc6f229..83f5a059a41 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -39,6 +39,11 @@ C_MODE_END
extern TYPELIB maria_recover_typelib;
extern ulonglong maria_recover_options;
+/*
+ In the ha_maria class there are a few virtual methods that are not marked as
+ 'final'. This is because they are re-defined by the ha_s3 engine.
+*/
+
class __attribute__((visibility("default"))) ha_maria :public handler
{
public:
@@ -61,98 +66,98 @@ public:
ha_maria(handlerton *hton, TABLE_SHARE * table_arg);
~ha_maria() {}
handler *clone(const char *name, MEM_ROOT *mem_root);
- const char *index_type(uint key_number);
- ulonglong table_flags() const
+ const char *index_type(uint key_number) override final;
+ ulonglong table_flags() const override final
{ return int_table_flags; }
- ulong index_flags(uint inx, uint part, bool all_parts) const;
- uint max_supported_keys() const
+ ulong index_flags(uint inx, uint part, bool all_parts) const override final;
+ uint max_supported_keys() const override final
{ return MARIA_MAX_KEY; }
- uint max_supported_key_length() const;
- uint max_supported_key_part_length() const
+ uint max_supported_key_length() const override final;
+ uint max_supported_key_part_length() const override final
{ return max_supported_key_length(); }
- enum row_type get_row_type() const;
- void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
- virtual double scan_time();
-
- int open(const char *name, int mode, uint test_if_locked);
- int close(void);
- int write_row(const uchar * buf);
- int update_row(const uchar * old_data, const uchar * new_data);
- int delete_row(const uchar * buf);
+ enum row_type get_row_type() const override final;
+ void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override final;
+ virtual double scan_time() override final;
+
+ int open(const char *name, int mode, uint test_if_locked) override;
+ int close(void) override final;
+ int write_row(const uchar * buf) override;
+ int update_row(const uchar * old_data, const uchar * new_data) override;
+ int delete_row(const uchar * buf) override;
int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
- enum ha_rkey_function find_flag);
+ enum ha_rkey_function find_flag) override final;
int index_read_idx_map(uchar * buf, uint idx, const uchar * key,
key_part_map keypart_map,
- enum ha_rkey_function find_flag);
+ enum ha_rkey_function find_flag) override final;
int index_read_last_map(uchar * buf, const uchar * key,
- key_part_map keypart_map);
- int index_next(uchar * buf);
- int index_prev(uchar * buf);
- int index_first(uchar * buf);
- int index_last(uchar * buf);
- int index_next_same(uchar * buf, const uchar * key, uint keylen);
- int ft_init()
+ key_part_map keypart_map) override final;
+ int index_next(uchar * buf) override final;
+ int index_prev(uchar * buf) override final;
+ int index_first(uchar * buf) override final;
+ int index_last(uchar * buf) override final;
+ int index_next_same(uchar * buf, const uchar * key, uint keylen) override final;
+ int ft_init() override final
{
if (!ft_handler)
return 1;
ft_handler->please->reinit_search(ft_handler);
return 0;
}
- FT_INFO *ft_init_ext(uint flags, uint inx, String * key);
- int ft_read(uchar * buf);
- int index_init(uint idx, bool sorted);
- int index_end();
- int rnd_init(bool scan);
- int rnd_end(void);
- int rnd_next(uchar * buf);
- int rnd_pos(uchar * buf, uchar * pos);
- int remember_rnd_pos();
- int restart_rnd_next(uchar * buf);
- void position(const uchar * record);
- int info(uint);
+ FT_INFO *ft_init_ext(uint flags, uint inx, String * key) override final;
+ int ft_read(uchar * buf) override final;
+ int index_init(uint idx, bool sorted) override final;
+ int index_end() override final;
+ int rnd_init(bool scan) override final;
+ int rnd_end(void) override final;
+ int rnd_next(uchar * buf) override final;
+ int rnd_pos(uchar * buf, uchar * pos) override final;
+ int remember_rnd_pos() override final;
+ int restart_rnd_next(uchar * buf) override final;
+ void position(const uchar * record) override final;
+ int info(uint) override final;
int info(uint, my_bool);
- int extra(enum ha_extra_function operation);
- int extra_opt(enum ha_extra_function operation, ulong cache_size);
- int reset(void);
- int external_lock(THD * thd, int lock_type);
- int start_stmt(THD *thd, thr_lock_type lock_type);
- int delete_all_rows(void);
- int disable_indexes(uint mode);
- int enable_indexes(uint mode);
- int indexes_are_disabled(void);
- void start_bulk_insert(ha_rows rows, uint flags);
- int end_bulk_insert();
+ int extra(enum ha_extra_function operation) override final;
+ int extra_opt(enum ha_extra_function operation, ulong cache_size) override final;
+ int reset(void) override final;
+ int external_lock(THD * thd, int lock_type) override;
+ int start_stmt(THD *thd, thr_lock_type lock_type) override final;
+ int delete_all_rows(void) override final;
+ int disable_indexes(uint mode) override final;
+ int enable_indexes(uint mode) override final;
+ int indexes_are_disabled(void) override final;
+ void start_bulk_insert(ha_rows rows, uint flags) override final;
+ int end_bulk_insert() override final;
ha_rows records_in_range(uint inx, const key_range *min_key,
const key_range *max_key,
- page_range *pages);
- void update_create_info(HA_CREATE_INFO * create_info);
- int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info);
+ page_range *pages) override final;
+ void update_create_info(HA_CREATE_INFO * create_info) override final;
+ int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info) override;
THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
- enum thr_lock_type lock_type);
+ enum thr_lock_type lock_type) override final;
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
- ulonglong *nb_reserved_values);
- int rename_table(const char *from, const char *to);
- int delete_table(const char *name);
- void drop_table(const char *name);
- int check(THD * thd, HA_CHECK_OPT * check_opt);
- int analyze(THD * thd, HA_CHECK_OPT * check_opt);
- int repair(THD * thd, HA_CHECK_OPT * check_opt);
- bool check_and_repair(THD * thd);
- bool is_crashed() const;
+ ulonglong *nb_reserved_values) override final;
+ int rename_table(const char *from, const char *to) override;
+ int delete_table(const char *name) override;
+ void drop_table(const char *name) override;
+ int check(THD * thd, HA_CHECK_OPT * check_opt) override;
+ int analyze(THD * thd, HA_CHECK_OPT * check_opt) override;
+ int repair(THD * thd, HA_CHECK_OPT * check_opt) override;
+ bool check_and_repair(THD * thd) override final;
+ bool is_crashed() const override final;
bool is_changed() const;
- bool auto_repair(int error) const;
- int optimize(THD * thd, HA_CHECK_OPT * check_opt);
- int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt);
- int preload_keys(THD * thd, HA_CHECK_OPT * check_opt);
- bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes);
+ bool auto_repair(int error) const override final;
+ int optimize(THD * thd, HA_CHECK_OPT * check_opt) override final;
+ int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt) override final;
+ int preload_keys(THD * thd, HA_CHECK_OPT * check_opt) override;
+ bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes) override final;
#ifdef HAVE_QUERY_CACHE
my_bool register_query_cache_table(THD *thd, const char *table_key,
uint key_length,
qc_engine_callback
*engine_callback,
- ulonglong *engine_data);
+ ulonglong *engine_data) override final;
#endif
MARIA_HA *file_ptr(void)
{
@@ -164,21 +169,21 @@ public:
* Multi Range Read interface
*/
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
- uint n_ranges, uint mode, HANDLER_BUFFER *buf);
- int multi_range_read_next(range_id_t *range_info);
+ uint n_ranges, uint mode, HANDLER_BUFFER *buf) override final;
+ int multi_range_read_next(range_id_t *range_info) override final;
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges, uint *bufsz,
- uint *flags, Cost_estimate *cost);
+ uint *flags, Cost_estimate *cost) override final;
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
uint key_parts, uint *bufsz,
- uint *flags, Cost_estimate *cost);
- int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size);
+ uint *flags, Cost_estimate *cost) override final;
+ int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) override final;
/* Index condition pushdown implementation */
- Item *idx_cond_push(uint keyno, Item* idx_cond);
+ Item *idx_cond_push(uint keyno, Item* idx_cond) override final;
- int find_unique_row(uchar *record, uint unique_idx);
+ int find_unique_row(uchar *record, uint unique_idx) override final;
/* Following functions are needed by the S3 handler */
virtual S3_INFO *s3_open_args() { return 0; }
diff --git a/storage/maria/ha_s3.h b/storage/maria/ha_s3.h
index 0777debc8d8..0dd36609a9e 100644
--- a/storage/maria/ha_s3.h
+++ b/storage/maria/ha_s3.h
@@ -19,7 +19,7 @@
#include "ha_maria.h"
-class ha_s3 :public ha_maria
+class ha_s3 final :public ha_maria
{
enum alter_table_op
{ S3_NO_ALTER, S3_ALTER_TABLE, S3_ADD_PARTITION, S3_ADD_TMP_PARTITION };
@@ -31,52 +31,52 @@ public:
~ha_s3() {}
int create(const char *name, TABLE *table_arg,
- HA_CREATE_INFO *ha_create_info) final;
- int open(const char *name, int mode, uint open_flags) final;
- int write_row(const uchar *buf) final;
- int update_row(const uchar * old_data, const uchar * new_data) final
+ HA_CREATE_INFO *ha_create_info);
+ int open(const char *name, int mode, uint open_flags);
+ int write_row(const uchar *buf);
+ int update_row(const uchar * old_data, const uchar * new_data)
{
DBUG_ENTER("update_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- int delete_row(const uchar * buf) final
+ int delete_row(const uchar * buf)
{
DBUG_ENTER("delete_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- int check(THD * thd, HA_CHECK_OPT * check_opt) final
+ int check(THD * thd, HA_CHECK_OPT * check_opt)
{
DBUG_ENTER("delete_row");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- int analyze(THD * thd, HA_CHECK_OPT * check_opt) final
+ int analyze(THD * thd, HA_CHECK_OPT * check_opt)
{
DBUG_ENTER("analyze");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- int repair(THD * thd, HA_CHECK_OPT * check_opt) final
+ int repair(THD * thd, HA_CHECK_OPT * check_opt)
{
DBUG_ENTER("repair");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- int preload_keys(THD * thd, HA_CHECK_OPT * check_opt) final
+ int preload_keys(THD * thd, HA_CHECK_OPT * check_opt)
{
DBUG_ENTER("preload_keys");
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
- int external_lock(THD * thd, int lock_type) final;
+ int external_lock(THD * thd, int lock_type);
/*
drop_table() is only used for internal temporary tables,
not applicable for s3
*/
- void drop_table(const char *name) final
+ void drop_table(const char *name)
{
}
- int delete_table(const char *name) final;
- int rename_table(const char *from, const char *to) final;
+ int delete_table(const char *name);
+ int rename_table(const char *from, const char *to);
int discover_check_version() override;
int rebind();
- S3_INFO *s3_open_args() final { return open_args; }
- void register_handler(MARIA_HA *file) final;
+ S3_INFO *s3_open_args() { return open_args; }
+ void register_handler(MARIA_HA *file);
};
#endif /* HA_S3_INCLUDED */
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index 7729ee2e9e7..3843004cc6e 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -41,7 +41,7 @@ C_MODE_START
check_result_t index_cond_func_myisam(void *arg);
C_MODE_END
-class ha_myisam: public handler
+class ha_myisam final : public handler
{
MI_INFO *file;
ulonglong int_table_flags;
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index d5d62a002aa..6da327ec84b 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -68,7 +68,7 @@ public:
};
-class ha_myisammrg: public handler
+class ha_myisammrg final : public handler
{
MYRG_INFO *file;
my_bool is_cloned; /* This instance has been cloned */
diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h
index 36ea124056d..690bf8d13a6 100644
--- a/storage/perfschema/ha_perfschema.h
+++ b/storage/perfschema/ha_perfschema.h
@@ -41,7 +41,7 @@ class PFS_engine_table;
extern const char *pfs_engine_name;
/** A handler for a PERFORMANCE_SCHEMA table. */
-class ha_perfschema : public handler
+class ha_perfschema final : public handler
{
public:
/**
diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc
index c8f3e76b873..d7f9014f691 100644
--- a/storage/sequence/sequence.cc
+++ b/storage/sequence/sequence.cc
@@ -53,7 +53,7 @@ public:
}
};
-class ha_seq: public handler
+class ha_seq final : public handler
{
private:
THR_LOCK_DATA lock;
diff --git a/storage/sphinx/ha_sphinx.h b/storage/sphinx/ha_sphinx.h
index cb46cb3dcbc..f03e9d8c797 100644
--- a/storage/sphinx/ha_sphinx.h
+++ b/storage/sphinx/ha_sphinx.h
@@ -30,7 +30,7 @@ struct CSphSEStats;
struct CSphSEThreadTable;
/// Sphinx SE handler class
-class ha_sphinx : public handler
+class ha_sphinx final : public handler
{
protected:
THR_LOCK_DATA m_tLock; ///< MySQL lock
diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h
index db184baf682..847f7a8e170 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -49,7 +49,7 @@ struct st_spider_ft_info
String *key;
};
-class ha_spider: public handler
+class ha_spider final : public handler
{
public:
SPIDER_SHARE *share;