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

Generated column's index not updated from RBR events (both Galera and async replication)

    XMLWordPrintable

Details

    Description

      Hi,

      In my particular case I tested this from a Galera cluster to an asynchronous slave, but I don't think the Galera part has anything to do with it.

      On the cluster, I have a schema. On the slave I have the same schema but with a denormalization of the week number:

      CREATE TABLE `example` (
        `id` char(36) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
        `user_id` char(36) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
        `event_code` int(11) NOT NULL,
        `local_date_time` datetime NOT NULL,
        `utc_date_time` datetime NOT NULL,
        `collection_id` char(36) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
      PRIMARY KEY(id)
      );

      On the slave I add a virtual column:

      ALTER TABLE example 
      	ADD `local_year_weeknum` int(11) GENERATED ALWAYS AS (year(`local_date_time`) * 100 + week(`local_date_time`, 0)) VIRTUAL,
      	ADD KEY `michael_user_yearweeknum_collection_eventcode` (`user_id`, `local_year_weeknum`, `collection_id`, `event_code`);
      

      I can find data that is already present in the example table, but when data comes in through replication it does not appear in the index.
      I can, however, select the same data using the clustered index.

      Thanks in advance!
      Michaël

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              michaeldg Michaël de groot
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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