server icon indicating copy to clipboard operation
server copied to clipboard

MDEV-12302: Execute triggers for foreign key updates/deletes [WIP]

Open Simoffsky opened this issue 1 year ago • 3 comments

  • [x] The Jira issue number for this PR is: MDEV-______

Description

TODO: fill description here

Release Notes

TODO: What should the release notes say about this change? Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.

How can this PR be tested?

TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended. Consult the documentation on "Writing good test cases".

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • [ ] This is a new feature or a refactoring, and the PR is based against the latest MariaDB development branch.
  • [ ] This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • [ ] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • [ ] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

Simoffsky avatar Jun 24 '24 11:06 Simoffsky

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: Simoffsky
:x: dr-m
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jun 24 '24 11:06 CLAassistant

we don't really want to push more of the server logic inside InnoDB. Besides triggers cascading updates/deletes have problems with CHECK constraints, unique constraints WITHOUT OVERLAP and USING HASH, online ALTER TABLE and likely other features.

The idea of MDEV-31942 was to let InnoDB inform the server via some kind of a callback when it performs cascading changes and the server could then do what is needed — triggers, checks, logging, statistics, whatever.

vuvova avatar Jul 10 '24 16:07 vuvova

@Simoffsky just to clarify what @vuvova means, we'll extract the maria_table->triggers->process_triggers call into the sql-layer function (somewhere in sql_class.cc). We do want to execute triggers from innodb cascade changes!

FooBarrior avatar Jul 10 '24 19:07 FooBarrior