Comment 4 for bug 1526105

Revision history for this message
Frank Cizmich (frank-cizmich) wrote : Re: pt-online-schema-change does not check maximum name length when creating tables

The problem is not the table name length, since there actually is code that tests this and truncates the name if it exceeds 64 characters.
The issue arises when there is an accumulation of tables that have already have had their names extended, the code retries ten times to append an underscore, each time finding an old table with that number appended undersocres.

This was the result I got starting with a table with a a name of exactly 64 characters:

show tables:
__________test12345678901234567890123456789012345678901234567890
_________test123456789012345678901234567890123456789012345678901
________test1234567890123456789012345678901234567890123456789012
_______test12345678901234567890123456789012345678901234567890123
______test123456789012345678901234567890123456789012345678901234
_____test1234567890123456789012345678901234567890123456789012345
____test12345678901234567890123456789012345678901234567890123456
___test123456789012345678901234567890123456789012345678901234567
__test1234567890123456789012345678901234567890123456789012345678
_test12345678901234567890123456789012345678901234567890123456789
test123456789012345678901234567890123456789012345678901234567890

It ran correctly 10 times, each time truncating and then appending an underscore. At the tenth run it failed because it assumes something weird is going on when it can't find a viable name after ten variations.

The debug output Agustin posted is indeed wrong in that it always says "Try 1 of 10" , when it should be incrementing "2 of 10", "3 of 10" etc. That should be corrected but it's not a serious problem.

So the question might be, is it reasonable for the tool to fail after 10 tries in this scenario?

Or maybe, should the tool create a quasi-unique random identifier, such as "4G6N8O_test" ?