• Nikita Malyavin's avatar
    MDEV-30985 Replica stops with error on ALTER ONLINE with Geometry Types · 5f206259
    Nikita Malyavin authored
    The bug is inherent for row-based replication as well.
    To reproduce, a virtual (not stored) field of a blob type computed from
    another field of a different blob type is required.
    
    The following happens during an update or delete row event:
    1. A row is unpacked.
    2. Virtual fields are updated. Field b1 stores the pointer in
       Field_blob::value and references it in table->record[0].
    3. record[0] is stored to record[1] in Rows_log_event::find_row.
    4. A new record is fetched from handler. (e.g. ha_rnd_next)
    5. Virtual columns are updated (only non-stored).
    6. Field b1 receives new value. Old value is deallocated
       (Field_blob::val_str).
    7. record_compare is called. record[0] and record[1] are compared.
    8. record[1] contains a reference to a freed value.
    
    record_compare is used in replication to find a matching record for update
    or delete. Virtual columns that are not stored should be definitely skipped
    both for correctness, and for this bug fix.
    
    STORED virtual columns, on the other hand, may be required and shouldn't be
    skipped. Stored columns are not affected, since they are not updated after
    handler's fetch.
    5f206259
rpl_geometry.test 871 Bytes