Check RowsAffected when applying DML events to get more accurate statistics by ajm188 · Pull Request #844 · github/gh-ost

…istics

Addresses github#600.

When applying a DML event, check the RowsAffected on the `Result`
struct. Since all DML event queries are point queries, this will only
ever be 0 or 1. The applier then takes this value and multiplies by
the `rowsDelta` of the event, resulting in a properly-signed, accurate
row delta to use in the statistics.

If an error occurs here, log it, but do not surface this as an
actual error .. simply assume the DML affected a row and move on. It
will be inaccurate, but this is already the case.

@timvaillancourt

@timvaillancourt

timvaillancourt

@timvaillancourt timvaillancourt temporarily deployed to production/mysql_role=ghost_testing

July 4, 2021 21:09

Inactive

@timvaillancourt timvaillancourt temporarily deployed to production/mysql_role=ghost_testing

July 4, 2021 21:09

Inactive

shlomi-noach

timvaillancourt

Co-authored-by: Tim Vaillancourt <timvaillancourt@github.com>

@timvaillancourt

@ghost ghost mentioned this pull request

Jul 7, 2022

ghost pushed a commit that referenced this pull request

Jul 7, 2022
…istics (#844)

* Check RowsAffected when applying DML events to get more accurate statistics

Addresses #600.

When applying a DML event, check the RowsAffected on the `Result`
struct. Since all DML event queries are point queries, this will only
ever be 0 or 1. The applier then takes this value and multiplies by
the `rowsDelta` of the event, resulting in a properly-signed, accurate
row delta to use in the statistics.

If an error occurs here, log it, but do not surface this as an
actual error .. simply assume the DML affected a row and move on. It
will be inaccurate, but this is already the case.

* Fix import

* update wording to warning log message

Co-authored-by: Tim Vaillancourt <timvaillancourt@github.com>

ghost pushed a commit that referenced this pull request

Jul 7, 2022
…istics (#844)

* Check RowsAffected when applying DML events to get more accurate statistics

Addresses #600.

When applying a DML event, check the RowsAffected on the `Result`
struct. Since all DML event queries are point queries, this will only
ever be 0 or 1. The applier then takes this value and multiplies by
the `rowsDelta` of the event, resulting in a properly-signed, accurate
row delta to use in the statistics.

If an error occurs here, log it, but do not surface this as an
actual error .. simply assume the DML affected a row and move on. It
will be inaccurate, but this is already the case.

* Fix import

* update wording to warning log message

Co-authored-by: Tim Vaillancourt <timvaillancourt@github.com>