Bug #104628 Unused assignment in MySQL-8.0.23
Submitted: 15 Aug 2021 23:37 Modified: 20 Aug 2021 12:21
Reporter: Li Zhong Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[15 Aug 2021 23:37] Li Zhong
Description:
The following assignment in MySQL-Server newest source code is unused:

Function                      	|Variable	| File				|Link
============================================================================
File_query_log::write_slow	|buff_len	|sql/log.cc			|https://github.com/mysql/mysql-server/blob/8.0/sql/log.cc#L708
The value buff_len may need debug assert or check?

get_form_pos			|names		|sql/table.cc			|https://github.com/mysql/mysql-server/blob/8.0/sql/table.cc#L1100
The variable names is assigned twice, which may be a redundant of #L1102?

Fil_shard::close_file		|LRU_close	|storage/innobase/fil/fil0fil.cc|https://github.com/mysql/mysql-server/blob/8.0/storage/innobase/fil/fil0fil.cc#L2842
The parametre LRU_close is unused, may need __attribute__(unused) to mark?

open_table_entry_fini		|result		|sql/sql_base.cc		|https://github.com/mysql/mysql-server/blob/8.0/sql/sql_base.cc#L3795
open_table_entry_fini		|result		|sql/sql_base.cc		|https://github.com/mysql/mysql-server/blob/8.0/sql/sql_base.cc#L3797
These two return value is unchecked/asserted.

buf_flush_write_block_low	|frame		|storage/innobase/buf/buf0flu.cc|https://github.com/mysql/mysql-server/blob/8.0/storage/innobase/buf/buf0flu.cc#L1252
The variable frame is assigned with new value but unused, which may be bug?

How to repeat:
It's in source code of MySQL-8.0.23
[16 Aug 2021 11:48] MySQL Verification Team
Hi Mr. Zhong,

Thank you, very much, for your analysis of our 8.0.23 code.

But, our latest released source code is 8.0.26. Can you re-check whether your analysis still stands in our current code ??????
[18 Aug 2021 7:58] Li Zhong
Sorry for mistyping. It stands for 8.0.23.
[18 Aug 2021 12:06] MySQL Verification Team
Hi Mr. Zhong,

We understood you were basing your analysis on 8.0.23. You do not have to repeat that fact.

However, our latest released source code is 8.0.26. Can you re-check whether your analysis still stands in our current code ??????

Waiting on your feedback.
[20 Aug 2021 4:51] Li Zhong
Sorry for mistyping again. It's 8.0.26.

So sorry for that. Sometimes what I type just diverges from what I think
[20 Aug 2021 12:21] MySQL Verification Team
Hi,

Regarding your questions ....

* We have never experienced a problem with that variable in that particular spot, so the answer is negative.

* Yes, it is redundant , so we have sent an e-mail to the corresponding team

* You are quite right regarding this parameter

* Actually, at that point, `result` does not need checks ......

* You are right about the last one too ......

Hence, we have decided to verify it .... These are small omissions, but your contribution is welcome.

Verified as reported.