Bug #89505 the value of table->s->uniques is always 0.
Submitted: 2 Feb 2018 1:39 Modified: 6 Feb 2018 13:12
Reporter: Eunbin Baek Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S3 (Non-critical)
Version:5.7.21 OS:CentOS (7.2.1511)
Assigned to: MySQL Verification Team CPU Architecture:Any

[2 Feb 2018 1:39] Eunbin Baek
Description:
Hi,

I found a strange code while I was looking at the code because of some issues.

In the code below, the value of table->s->uniques is always 0(zero) even if there is a unique key in the table.

https://github.com/mysql/mysql-server/blob/mysql-5.7.21/sql/log_event.cc#L9547

I think there is no initialization of this value in the code.

It does not seem to be a problem in a general case, but if someone develops the function by referring to this value, it may be a problem.

How to repeat:
See the code.

Suggested fix:
If you do not use this value, you can delete it from the code or if you use it, you can put the right value.
[2 Feb 2018 15:45] MySQL Verification Team
Hi,

Not sure I follow why you expect initialization of the table->s->uniques in search_key_in_table() function when table is input parameter here?

all best
Bogdan
[5 Feb 2018 1:48] Eunbin Baek
Hi,

That's not what I meant.
I mean, there is no code in the whole code that sets the 'table-s-uniques' value to the right value, not in search_key_in_table()

Regards,
[6 Feb 2018 3:22] MySQL Verification Team
Hi,

You maybe are on to something here, looking trough code I can only see it being set to 0 and queries, never set to any other value.

all best
Bogdan
[6 Feb 2018 13:07] MySQL Verification Team
Hi,

Yes, you are right, and this is already removed in the MySQL 8.0

thanks for your report
bogdan
[6 Feb 2018 13:12] MySQL Verification Team
also a duplicate of bug#81501