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

mariadb-binlog does not count GEOMETRY rows correctly

    XMLWordPrintable

Details

    • Unexpected results

    Description

      mariadb-binlog prints the binary log entry for this statement

      INSERT INTO t VALUES
        (ST_GeomFromText('POINT(1 2)')),
        (ST_GeomFromText('POINT(3 4)'));
      

      with

      # Number of rows: 1
      

      , no --flashback required.

      Code Analysis

      The code path uses Rows_log_event::calc_row_event_length() to iterate through a row image.
      This method checks both table_def::calc_field_size() and calc_field_event_length() for data validity (even though it only uses calc_field_event_length()'s output).
      But calc_field_event_length() does not recognize many data types compared to table_def::calc_field_size() - GEOMETRY beïng one of them, so the 2nd validity check fails, and the counter silently aborts (or emits an error in MDEV-20749) at 1.

      Although the duplication between these two functions is technically a separate topic, replacing calc_field_event_length() with table_def::calc_field_size() would fix this issue.
      mariadb-binlog --verbose's separate, duplicate (uh) code path that uses only table_def::calc_field_size() proves this, as it is not affected by this issue.

      Attachments

        Issue Links

          Activity

            People

              ParadoxV5 Jimmy Hú
              ParadoxV5 Jimmy Hú
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1.5d
                  1.5d
                  Remaining:
                  Time Spent - 3h 20m Remaining Estimate - 1d
                  1d
                  Logged:
                  Time Spent - 3h 20m Remaining Estimate - 1d Time Not Required
                  3h 20m

                  Git Integration

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