mariadb/storage
Daniel Lenski 6e406bb654 Fix inconsistent definition of PERFORMANCE_SCHEMA.REPLICATION_APPLIER_STATUS.COUNT_TRANSACTIONS_RETRIES column
This column (`COUNT_TRANSACTIONS_RETRIES`) is defined as `BIGINT UNSIGNED`
(64-bit unsigned integer) in the user-visible SQL definition:
182ff21ace/storage/perfschema/table_replication_applier_status.cc (L66)

    "COUNT_TRANSACTIONS_RETRIES BIGINT unsigned not null comment 'The number of retries that were made because the replication SQL thread failed to apply a transaction.',"

And its value is internally set/updated using the `set_field_ulonglong`
function:
182ff21ace/storage/perfschema/table_replication_applier_status.cc (L231-L233)

    case 3: /* total number of times transactions were retried */
      set_field_ulonglong(f, m_row.count_transactions_retries);
      break;

… but the structure where it is stored allocates only `ulong` for it:
182ff21ace/storage/perfschema/table_replication_applier_status.h (L62)

    ulong count_transactions_retries;

As a result of this inconsistency:

1. On any platform where `ulong` is `uint32_t` and `ulonglong` is `uint64_t`,
   setting this value would corrupt the 4 bytes of memory *following* the 4
   bytes actually allocated for it.

   Likely this problem was never noticed because this is the final element in
   the structure, and the structure is padded by the compiler to prevent
   memory corruption errors.

2. On any BIG-ENDIAN platform where `ulong` is `uint32_t` and `ulonglong`
   is `uint64_t`, reading back the value of this column will result in
   total garbage.

   Likely this problem was never noticed because MariaDB has not been
   tested on 32-bit big-endian platforms.

In order not to affect the user-visible/SQL definition of this column, the
correct way to fix this issue is to change it to `ulonglong` in the
structure definition.  See
https://github.com/MariaDB/server/pull/2763/files#r1329110832 for the
original identification and discussion of this issue.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the BSD-new
license. I am contributing on behalf of my employer Amazon Web Services
2024-02-08 13:16:35 +11:00
..
archive Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
blackhole Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
cassandra Merge commit '10.4' into 10.5 2023-07-20 11:54:52 +02:00
columnstore MDEV-33290: Disable ColumnStore based on boost version 2024-01-23 15:20:25 +11:00
connect Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
csv Merge branch 'bb-10.4-release' into bb-10.5-release 2021-02-15 16:43:15 +01:00
example Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
federated Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
federatedx Merge branch '10.4' into 10.5 2024-01-31 17:32:53 +01:00
heap Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
innobase MDEV-33023 Crash in mariadb-backup --prepare --export after --prepare 2024-02-07 23:12:15 +05:30
maria MDEV-33092 Undefined reference to concurrency on Solaris 2024-01-10 10:16:20 +01:00
mroonga Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
myisam Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
myisammrg MDEV-31083 ASAN use-after-poison in myrg_attach_children 2023-05-23 09:16:36 +03:00
oqgraph Merge 10.4 into 10.5 2023-09-11 11:29:31 +03:00
perfschema Fix inconsistent definition of PERFORMANCE_SCHEMA.REPLICATION_APPLIER_STATUS.COUNT_TRANSACTIONS_RETRIES column 2024-02-08 13:16:35 +11:00
rocksdb Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
sequence Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
sphinx Merge branch '10.4' into 10.5 2024-01-10 18:01:46 +11:00
spider MDEV-33174 Fixing nondeterministic self-referencing test result 2024-02-07 17:34:15 +11:00
test_sql_discovery Merge remote-tracking branch 'origin/10.4' into 10.5 2022-09-14 16:24:51 +04:00
tokudb Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00