[MDEV-16546] System versioning setting to allow history modification Created: 2018-06-21 Updated: 2023-08-07 Resolved: 2022-10-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Versioned Tables |
| Fix Version/s: | 10.11.1 |
| Type: | Task | Priority: | Critical |
| Reporter: | Aleksey Midenkov | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 8 |
| Labels: | Preview_10.11 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
Add a session server variable @@system_versioning_insert_history which allows to use ROW_START and ROW_END columns in the INSERT (unless they are normal visible (in SELECT *) fields, they have to be explicitly specified in INSERT as any invisible fields are). And if @@secure_timestamp allows the current user to modify @@timestamp then he should be able to insert directly into ROW_START/ROW_END columns. The use case of this is to be able to dump the history with mysqldump and to load it back later (
So this new feature does not provide any new functionality, but allows to load the history dump much faster than with timestamp manipulations as above. In particular it does not allow to do anything that wasn't possible to do before, it requires exactly the same set of privileges as the snippet above, and is subject to the same set of restrictions. |
| Comments |
| Comment by Sergei Golubchik [ 2018-06-21 ] | |||||||||||||
|
no sql mode please. make it a separate sysvar. | |||||||||||||
| Comment by Michael McClennen [ 2020-05-10 ] | |||||||||||||
|
I am very anxious to use system versioning, but I cannot make the changeover until this feature is available. This is due to the fact that I have existing history data that needs to be moved over to the new system. I am glad to see that it is In Review, and hope to see it in the next MariaDB release. | |||||||||||||
| Comment by Nayuta Yanagisawa (Inactive) [ 2020-10-24 ] | |||||||||||||
|
I also interested in the system versioning. If I could get logical backup by mysqldump, it would be great for me. The ticket for such a feature seems to be blocked by this ticket. There are several PRs for this JIRA issue, while they are not merged. Could anyone let me know how things are going? | |||||||||||||
| Comment by Federico Razzoli [ 2021-06-12 ] | |||||||||||||
|
If anyone can do this, I see a security risk. | |||||||||||||
| Comment by Sergei Golubchik [ 2021-06-12 ] | |||||||||||||
|
f_razzoli, it's just a convenience feature. It doesn't allow to do anything that one wasn't allowed to do before. Say, you want to have a fake history record that tells that a row with the value V existed from timestamp A to timestamp B. You can do it as
Note, that this is only allowed for certain values of @@secure_timestamp variable. For example, with @@secure_timestamp=YES no one can fake history. In this issue we want to simplify the above to
This is primarily to be able to use multi-row inserts in mysqldump. This convenience feature won't do any additional privilege checks, it will work for everyone who can change @@timestamp as above, so it'll obey @@secure_timestamp setting. | |||||||||||||
| Comment by Aleksey Midenkov [ 2022-08-02 ] | |||||||||||||
|
Please review bb-10.6-midenok | |||||||||||||
| Comment by Aleksey Midenkov [ 2022-08-28 ] | |||||||||||||
|
Please review bb-10.11-midenok-MDEV-16546 | |||||||||||||
| Comment by Sergei Golubchik [ 2022-09-07 ] | |||||||||||||
|
I've interrupted the review, as I stumbled on a bug, try this test case:
This INSERT uses a different fill_record() function and does not go into Item_field::fix_fields(). | |||||||||||||
| Comment by Aleksey Midenkov [ 2022-09-13 ] | |||||||||||||
|
Fixed. It should not go into Item_field::fix_fields() because there is no explicit field list (so no Item_field). It uses different fill_record() for implicit field list, that's normal. | |||||||||||||
| Comment by Aleksey Midenkov [ 2022-09-13 ] | |||||||||||||
|
I wanted to split THD::vers_insert_history(Field *) into Field::vers_insert_history(THD *) and THD::vers_insert_history(). But they both cannot be inline (or it sort of hard to rule out without inline files) because Field::vers_insert_history(THD *) must call THD::vers_insert_history() but sql_class.h is not included into field.h. serg, I remember about your inline request. | |||||||||||||
| Comment by Sergei Golubchik [ 2022-09-15 ] | |||||||||||||
|
midenok, you haven't fixed the issue yet. You don't have the test case for it. If you do
you'll see that values are ignored | |||||||||||||
| Comment by Sergei Golubchik [ 2022-09-17 ] | |||||||||||||
|
pushed into bb-10.11- | |||||||||||||
| Comment by Elena Stepanova [ 2022-10-20 ] | |||||||||||||
|
I have no objections against pushing bb-10.11- Some notes in no particular order (greenman FYI):
|