Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19710

Split the server side code in rpl_utility.cc into virtual methods in Type_handler

    XMLWordPrintable

Details

    Description

      The server side code in rpl_utility.cc is not friendly to pluggable data types, which will want to have their own rules on data type conversion during replication.

      The client side code used by mysqlbinlog is out of scope of this task.

      The affected functions:

      • max_display_length_for_field()
      • show_sql_type()
      • can_convert_field_to()

      Instead of testing for field->real_type() inside these functions, we'll introduce the following new code:

      • New data types:

        enum enum_conv_type
        {
          CONV_TYPE_PRECISE,
          CONV_TYPE_VARIANT,
          CONV_TYPE_SUBSET_TO_SUPERSET,
          CONV_TYPE_SUPERSET_TO_SUBSET,
          CONV_TYPE_IMPOSSIBLE
        };
         
         
        class Conv_param
        {
          uint16 m_table_def_flags;
        public:
          Conv_param(uint16 table_def_flags)
           :m_table_def_flags(table_def_flags)
          { }
          uint16 table_def_flags() const { return m_table_def_flags; }
        };
         
         
        class Conv_source: public Type_handler_hybrid_field_type
        {
          enum_field_types m_type;
          uint16 m_metadata;
          CHARSET_INFO *m_cs;
        public:
          Conv_source(const Type_handler *h, uint16 metadata, CHARSET_INFO *cs)
           :Type_handler_hybrid_field_type(h),
            m_metadata(metadata),
            m_cs(cs)
          {
            DBUG_ASSERT(cs);
          }
          uint16 metadata() const { return m_metadata; }
          uint mbmaxlen() const { return m_cs->mbmaxlen; }
        };
        

      • A new virtual method in Field

        virtual enum_conv_type rpl_conv_type_from(const Conv_source &source,
                                                  const Relay_log_info *rli,
                                                  const Conv_param &param)
                                                  const;
        

      • A new virtual method in Field

        enum_conv_type rpl_conv_type_from_same_data_type(uint16 metadata,
                                                         const Relay_log_info *rli,
                                                         const Conv_param &param)
                                                         const;
        

      • A new method in Type_handler

        virtual void show_binlog_type(const Conv_source &src, String *str) const;
        

      • A new virtual method in Type_handler

        virtual uint32 max_display_length_for_field(const Conv_source &src) const;
        

      Let's also put the new code into a new file rpl_utility_server.cc, to split the server side code and the client side code.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.