Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-16490: It's possible to make a system versioned table without an… #803

Closed
wants to merge 1 commit into from

Conversation

FooBarrior
Copy link
Contributor

…y versioning field

  • do not allow versioned table to be without versioned (non-system) fields
  • prohibit changing field versioning, when removing table versioning

@svoj svoj added this to the 10.3 milestone Jun 29, 2018
…y versioning field

* do not allow versioned table to be without versioned (non-system) fields
* prohibit changing field versioning, when removing table versioning
Copy link
Member

@robertbindar robertbindar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @FooBarrior, sorry it took me so long to get to this. The patch looks excellent, I have some minor suggestions inline, otherwise the code is ok to push. Thanks!

goto err;
uint versioned_fields= 0;
field_it.rewind();
while (Create_field *f= field_it++)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe early return the loop if we already counted more than VERSIONING_FIELDS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will bring unnecessary complications. In particular, the value of versioned_fields will be inconsistent after the loop. This can confuse somebody else later.

@@ -8473,11 +8473,21 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}

if (table->versioned() && !(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING) &&
new_create_list.elements == VERSIONING_FIELDS)
if (table->versioned())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate a lot if you could try to move this new code into a helper function, the size of mysql_prepare_alter_table is already astronomical.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did it with a new version

@@ -7039,7 +7039,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,

if (alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING)
{
if (!share->versioned)
if (!share->versioned || create_info->versioned())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment "Prohibit changing field versioning, when removing table versioning".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok no problem

@FooBarrior
Copy link
Contributor Author

Hi, @robertbindar!
One important part including the fix for create...select was missing on the branch. Maybe I forgot to push or something.

But anyway, here it is: https://github.com/MariaDB/server/commits/bb-10.3-MDEV-16490
Please, let's continue there, in comments. I can't push to tempesta repository anymore.

The aforementioned fix also naturally covers your request for moving the code in a separate function

@robertbindar
Copy link
Member

Hi @FooBarrior! I left some comments in the commits in bb-10.3-MDEV-16490, great work on handling the create..select case, thanks!

@FooBarrior
Copy link
Contributor Author

Thank you for the new review, @robertbindar!
I have added the fix-up commit on the top of the branch.

@robertbindar
Copy link
Member

Hi @FooBarrior! This should be ready to be closed right? Also any clarification here about the partition fix you submitted will be highly appreciated.

@FooBarrior
Copy link
Contributor Author

Hi! Yes, it could be closed now. The partition test fails because of another concurrent improvement by MDEV-15408. I have just adjusted the code to be consistent for now, but there is MDEV-20507 to make diagnostics correct in case of partitioning.

@FooBarrior FooBarrior closed this Sep 10, 2019
@krizhanovsky krizhanovsky deleted the tt-10.3-MDEV-16490 branch May 20, 2020 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants