diff --git a/sql/log_event.h b/sql/log_event.h index 64284c8b9bcae..3f370ba9afa90 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -4562,7 +4562,7 @@ class Rows_log_event : public Log_event Log_event_type get_type_code() { return m_type; } /* Specific type (_V1 etc) */ enum_logged_status logged_status() { return LOGGED_ROW_EVENT; } - virtual Log_event_type get_general_type_code() = 0; /* General rows op type, no version */ + virtual Log_event_type get_general_type_code() const = 0; /* General rows op type, no version */ #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) virtual void pack_info(Protocol *protocol); @@ -4673,7 +4673,7 @@ class Rows_log_event : public Log_event const uchar* get_extra_row_data() const { return m_extra_row_data; } #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual uint8 get_trg_event_map()= 0; + virtual uint8 get_trg_event_map() const = 0; inline bool do_invoke_trigger() { @@ -4851,8 +4851,8 @@ class Rows_log_event : public Log_event virtual int do_update_pos(rpl_group_info *rgi); virtual enum_skip_reason do_shall_skip(rpl_group_info *rgi); - /* - Primitive to prepare for a sequence of row executions. + /** + @brief Primitive to prepare for a sequence of row executions. DESCRIPTION @@ -4862,16 +4862,15 @@ class Rows_log_event : public Log_event space for any buffers that are needed for the two member functions mentioned above. - RETURN VALUE - + @return The member function will return 0 if all went OK, or a non-zero error code otherwise. */ virtual int do_before_row_operations(const rpl_group_info *) = 0; - /* - Primitive to clean up after a sequence of row executions. + /** + @brief Primitive to clean up after a sequence of row executions. DESCRIPTION @@ -4884,11 +4883,10 @@ class Rows_log_event : public Log_event function is successful, it should return the error code given in the argument. */ virtual - int do_after_row_operations(const Slave_reporting_capability *const log, - int error) = 0; + int do_after_row_operations(int error) = 0; - /* - Primitive to do the actual execution necessary for a row. + /** + @brief Primitive to do the actual execution necessary for a row. DESCRIPTION The member function will do the actual execution needed to handle a row. @@ -4896,7 +4894,7 @@ class Rows_log_event : public Log_event m_curr_row_end should point at the next row (one byte after the end of the current row). - RETURN VALUE + @return 0 if execution succeeded, 1 if execution failed. */ @@ -4916,11 +4914,8 @@ class Rows_log_event : public Log_event class Write_rows_log_event : public Rows_log_event { public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = WRITE_ROWS_EVENT - }; + /* Support interface to THD::binlog_prepare_pending_rows_event */ + static constexpr Log_event_type TYPE_CODE = WRITE_ROWS_EVENT; #if defined(MYSQL_SERVER) Write_rows_log_event(THD*, TABLE*, ulong table_id, @@ -4946,20 +4941,20 @@ class Write_rows_log_event : public Rows_log_event #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); + uint8 get_trg_event_map() const override; #endif private: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_general_type_code() const override { return TYPE_CODE; } #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const rpl_group_info *); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const rpl_group_info *) override; + int do_after_row_operations(int) override; + int do_exec_row(rpl_group_info *) override; #endif }; @@ -4977,7 +4972,7 @@ class Write_rows_compressed_log_event : public Write_rows_log_event #endif private: #if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif }; @@ -4996,11 +4991,8 @@ class Write_rows_compressed_log_event : public Write_rows_log_event class Update_rows_log_event : public Rows_log_event { public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = UPDATE_ROWS_EVENT - }; + /* Support interface to THD::binlog_prepare_pending_rows_event */ + static constexpr Log_event_type TYPE_CODE = UPDATE_ROWS_EVENT; #ifdef MYSQL_SERVER Update_rows_log_event(THD*, TABLE*, ulong table_id, @@ -5009,7 +5001,7 @@ class Update_rows_log_event : public Rows_log_event void init(MY_BITMAP const *cols); #endif - virtual ~Update_rows_log_event(); + ~Update_rows_log_event() override; #ifdef HAVE_REPLICATION Update_rows_log_event(const uchar *buf, uint event_len, @@ -5030,26 +5022,26 @@ class Update_rows_log_event : public Rows_log_event } #endif - virtual bool is_valid() const + bool is_valid() const override { return Rows_log_event::is_valid() && m_cols_ai.bitmap; } #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); + uint8 get_trg_event_map() const override; #endif protected: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_general_type_code() const override { return TYPE_CODE; } #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const rpl_group_info *); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const rpl_group_info *) override; + int do_after_row_operations(int) override; + int do_exec_row(rpl_group_info *) override; #endif /* defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) */ }; @@ -5067,7 +5059,7 @@ class Update_rows_compressed_log_event : public Update_rows_log_event #endif private: #if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif }; @@ -5094,11 +5086,8 @@ class Update_rows_compressed_log_event : public Update_rows_log_event class Delete_rows_log_event : public Rows_log_event { public: - enum - { - /* Support interface to THD::binlog_prepare_pending_rows_event */ - TYPE_CODE = DELETE_ROWS_EVENT - }; + /* Support interface to THD::binlog_prepare_pending_rows_event */ + static constexpr Log_event_type TYPE_CODE = DELETE_ROWS_EVENT; #ifdef MYSQL_SERVER Delete_rows_log_event(THD*, TABLE*, ulong, bool is_transactional); @@ -5123,20 +5112,20 @@ class Delete_rows_log_event : public Rows_log_event #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - uint8 get_trg_event_map(); + uint8 get_trg_event_map() const override; #endif protected: - virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } + Log_event_type get_general_type_code() const override { return TYPE_CODE; } #ifdef MYSQL_CLIENT - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif #if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION) - virtual int do_before_row_operations(const rpl_group_info *const); - virtual int do_after_row_operations(const Slave_reporting_capability *const,int); - virtual int do_exec_row(rpl_group_info *); + int do_before_row_operations(const rpl_group_info *const) override; + int do_after_row_operations(int) override; + int do_exec_row(rpl_group_info *) override; #endif }; @@ -5153,7 +5142,7 @@ class Delete_rows_compressed_log_event : public Delete_rows_log_event #endif private: #if defined(MYSQL_CLIENT) - bool print(FILE *file, PRINT_EVENT_INFO *print_event_info); + bool print(FILE *file, PRINT_EVENT_INFO *print_event_info) override; #endif }; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 30d4fbd340a61..da28074bfc8c0 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -5206,7 +5206,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) const_cast(rli)->abort_slave= 1;); } - if (unlikely(error= do_after_row_operations(rli, error)) && + if (unlikely(error= do_after_row_operations(error)) && ignored_error_code(convert_handler_error(error, thd, table))) { @@ -6538,8 +6538,7 @@ Write_rows_log_event::do_before_row_operations(const rpl_group_info *) } int -Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const, - int error) +Write_rows_log_event::do_after_row_operations(int error) { int local_error= 0; @@ -7016,7 +7015,7 @@ Write_rows_log_event::do_exec_row(rpl_group_info *rgi) #if defined(HAVE_REPLICATION) -uint8 Write_rows_log_event::get_trg_event_map() +uint8 Write_rows_log_event::get_trg_event_map() const { return trg2bit(TRG_EVENT_INSERT) | trg2bit(TRG_EVENT_UPDATE) | trg2bit(TRG_EVENT_DELETE); @@ -7735,8 +7734,7 @@ Delete_rows_log_event::do_before_row_operations(const rpl_group_info *rgi) } int -Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const, - int error) +Delete_rows_log_event::do_after_row_operations(int error) { m_table->file->ha_index_or_rnd_end(); my_free(m_key); @@ -7821,7 +7819,7 @@ int Delete_rows_log_event::do_exec_row(rpl_group_info *rgi) #endif /* defined(HAVE_REPLICATION) */ #if defined(HAVE_REPLICATION) -uint8 Delete_rows_log_event::get_trg_event_map() +uint8 Delete_rows_log_event::get_trg_event_map() const { return trg2bit(TRG_EVENT_DELETE); } @@ -7895,8 +7893,7 @@ Update_rows_log_event::do_before_row_operations(const rpl_group_info *rgi) } int -Update_rows_log_event::do_after_row_operations(const Slave_reporting_capability *const, - int error) +Update_rows_log_event::do_after_row_operations(int error) { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); @@ -8038,7 +8035,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) #if defined(HAVE_REPLICATION) -uint8 Update_rows_log_event::get_trg_event_map() +uint8 Update_rows_log_event::get_trg_event_map() const { return trg2bit(TRG_EVENT_UPDATE); }