WL#9513: Introduce new sys variable to include estimates for delete marked records

Affects: Server-8.0   —   Status: Complete

PROBLEM

By design stats estimation always reads uncommitted data. In this scenario
an uncommitted transaction has deleted all rows in the table. In Innodb
uncommitted delete records are marked as deleted but not actually removed
from Btree until the transaction has committed or a read view for the rows
is present. While calculating persistent stats we were ignoring the delete
marked records, since all the records are delete marked we were estimating
the number of rows present in the table as zero which leads to bad query plans
for other transactions operating on the table.

Fix

Introduce a system variable called innodb_stats_include_delete_marked 
which when enabled includes delete marked records in calculation of table and
index statistics.