[MXS-3894] Invent a configuration option to allow transaction replay ignore checksum check Created: 2021-11-24  Updated: 2021-12-09  Resolved: 2021-12-08

Status: Closed
Project: MariaDB MaxScale
Component/s: readwritesplit
Affects Version/s: None
Fix Version/s: 6.2.1

Type: New Feature Priority: Critical
Reporter: Gregory Dorman (Inactive) Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MXS-3379 Make transaction_replay less strict Closed
is duplicated by MXS-3901 Optionally ignore LAST_INSERT_ID() in... Closed
Sprint: MXS-SPRINT-146

 Description   

In some workflows, particularly the one in one of the important POCs today, unconditional application of the checksum test prevents replay from being used, even though the transaction logic does not in any way merit it.

The off-the-top proposal is to allow me to blacklist a bunch of tables and standard functions. MaxScale would skip the checksum if running into a SELECT from any one of these tables. It should be limited to selects without joins.

For the POC, a lot less is enough. Skip checksum test on SELECT LAST_INSERT_ID.



 Comments   
Comment by Johan Wikman [ 2021-11-29 ]

If SELECT LAST_INSERT_ID() is present in the statements to be replayed it means that the result of that statement already has been sent to the client. If the replay fails due to a checksum mismatch when that statement is executed, it means that the last insert id is different the second time around, perhaps because somebody else has modified the table in the meantime.

If the mismatch is ignored, the application will believe that the last insert id is different from what it actually is. Is that something the application can deal with?

Comment by markus makela [ 2021-12-07 ]

Adding a transaction_replay_checksum parameter with the values full, result_only and no_insert_id allows for the following behavior:

  • transaction_replay_checksum=full is how it works currently: the checksum is calculated from all responses and the replayed transaction is known to be consistent with what the client has seen.
  • transaction_replay_checksum=result_only excludes OK packets (responses that aren't resultsets or errors) from the checksum. This effectively ignores the auto-generated insert ID for cases where the application doesn't explicitly request it via SQL. Currently this also ignores the OK packets generated by UPDATE statements which can cause the number of affected rows to change (might need to be adjusted if this is a problem). This still detects if a statement fails to execute as error packets are included in the checksum and they cause it to diverge if one of the statements fail that previously worked.
  • transaction_replay_checksum=no_insert_id ignores both OK packets and results from queries that use the LAST_INSERT_ID() function (or any of its aliases). This is only safe for very specific use-cases where the function is unconditionally used or when the fact that the real inserted ID is not the one the client has is not a problem. The same limitations that apply to result_only also apply to this mode.
Generated at Thu Feb 08 04:24:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.