[MDEV-22164] WITHOUT VALIDATION for EXCHANGE PARTITION/CONVERT IN Created: 2020-04-06 Updated: 2024-01-23 Resolved: 2024-01-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Partitioning |
| Fix Version/s: | 11.4.1 |
| Type: | New Feature | Priority: | Critical |
| Reporter: | Michael Widenius | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 4 |
| Labels: | Compatibility, Preview_11.4 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Description |
GoalAdd support for WITH VALIDATION | WITHOUT VALIDATION to WITH VALIDATION should be the default behavior. Must also cover CONVERT {TABLE|PARTITION} TO BackgroundWhen WITHOUT VALIDATION is specified, there is no check that all rows in the added table fulfills the partition restrictions. If there is inconsistencies, it will result in rows later not being found in SELECT, UPDATE or DELETE. MySQL has had this since 5.7.5 and it's important when adding big tables to a partitioned table to avoid the expensive row-by-row check.
|
| Comments |
| Comment by Colin Luo [ 2023-09-14 ] | |||||||||||||||||||||||||||||||||||||||
|
Just following up if there is any update on making “WITHOUT VALIDATION“ option available for exchange partitions. It will be nice to have that option because we are using partition exchange functionality for deploying large amount of data in the production environment. Thanks a ton! | |||||||||||||||||||||||||||||||||||||||
| Comment by Aleksey Midenkov [ 2023-11-15 ] | |||||||||||||||||||||||||||||||||||||||
|
Please review bb-11-midenok | |||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2023-11-16 ] | |||||||||||||||||||||||||||||||||||||||
|
Generally everything looks OK, but :
| |||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-12-18 ] | |||||||||||||||||||||||||||||||||||||||
|
The "supplemental feature" (making THAN keyword optional) wasn't a part of the original task, isn't required for the functionality, doesn't seem to be a part of any compatibility effort (as far as I can see, MySQL 8.x does not support it), and in general looks more like a typo than a valid expression:
| |||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-12-18 ] | |||||||||||||||||||||||||||||||||||||||
|
Right. midenok, please revert this. | |||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-12-19 ] | |||||||||||||||||||||||||||||||||||||||
|
We need proper documentation for how an admin should handle a corrupt table produced with the use of WITHOUT VALIDATION clause. The MySQL manual is no help here, it claims that it
however it is not true (not even for MySQL):
Maybe it should be ALTER TABLE .. REBUILD PARTITION, at least it seems to work. | |||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-12-20 ] | |||||||||||||||||||||||||||||||||||||||
|
It may be useful to add a status variable Feature_without_validation or something like that counting specifically "without". | |||||||||||||||||||||||||||||||||||||||
| Comment by Ralf Gebhardt [ 2023-12-21 ] | |||||||||||||||||||||||||||||||||||||||
|
I like the idea of logging operations which can make the database inconsistent, also if SET FOREIGN_KEY_CHECKS=0; is used, but we might get too many variables. Adding a warning to the server log could be a first simple solution, and it would not be just a counter but would include a timestamp. I am not sure about the overhead a new log file would have, which would only include such cases. serg, what do you think? | |||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-12-22 ] | |||||||||||||||||||||||||||||||||||||||
|
Feature_without_validation is really simple and can likely be done either way. Also we might, perhaps, mark the frm as "tainted", write a special flag there, it's not difficult. SET FOREIGN_KEY_CHECKS=0 is a different story. We cannot mark it in the frm, as DMLs don't modify frm. A warning in the server log is simple, sure. It won't show, though, what tables were affected. But there's also a question — set foreign_key_checks=0 can easily violate data consistency, should it be a privileged operation? Same for unique_checks and check_constraint_checks. Either way, this discussion doesn't really belong here. | |||||||||||||||||||||||||||||||||||||||
| Comment by Ralf Gebhardt [ 2023-12-28 ] | |||||||||||||||||||||||||||||||||||||||
|
After some discussion with serg I personally would conclude that:
| |||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-12-28 ] | |||||||||||||||||||||||||||||||||||||||
|
Feature_x counters are not an ultimate weapon, but it doesn't mean they are useless. As happens quite often, if they don't show anything, it doesn't mean much, but if it does show something, it is useful information. 1) Production instances aren't typically restarted without a reason, and issues with invalid tables won't necessarily lead to a crash, so it may well be that a problem under investigation originated from the ongoing server session; That said, I'm not going to insist on adding the counter, I just don't understand why not have it, especially if apparently there isn't any realistic plan to have a more reliable diagnostics. After all, Feature_x is quite a standard thing in MariaDB, not any innovation. | |||||||||||||||||||||||||||||||||||||||
| Comment by Ralf Gebhardt [ 2023-12-28 ] | |||||||||||||||||||||||||||||||||||||||
|
elenst you are definitely right, Feature_x even only as a counter of the used feature still makes sense. And therefor also indicates that partitions should be checked as long as it is >0. serg, could the flag you mentioned for the .frm file be used in information_schema.partitions to mark a partition which was not validated? | |||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-12-28 ] | |||||||||||||||||||||||||||||||||||||||
|
yes | |||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2024-01-08 ] | |||||||||||||||||||||||||||||||||||||||
|
unfortunately, ALTER TABLE ... EXCHANGE PARTITION does not touch the .frm file, so it cannot add a flag there. |