If multiplanning runs for enough works then it can overflow its totalWorks counter into a negative value that causes a tassert to fail.
MultiPlanStats.totalWorks is defined as a 32 bit signed int and used to track the total number of works performed across all plans during multiplanning.
If the total number of works over all the plans exceeds INT_MAX (around 2.1 billion, which seems possible for a very large collection with lots of candidate plans) then _specificStats.totalWorks overflows. pickBestPlan() has a tassert that checks _specificStats.totalWorks > 0, which will fail in this scenario.
One solution would be to define MultiPlanStats.totalWorks as a 64-bit unsigned integer, which increases the maximum value to 264. There’s no reason this counter should be signed, and this max value is large enough that we can be sure we’ll never overflow since this counter only lasts for the multiplanner lifetime of one query.
Also add the value of totalWorks to the tassert log here so that if the diagnosis of AF-18444 turns out to be incorrect and the same bug reoccurs then we'll have that information.
Consider backporting this into 8.3 as well for the sake of the logging information and future AFs.
- is related to
-
SERVER-130575 Bulk/batch write stats may overflow
-
- Backlog
-
-
SERVER-130576 InitialSyncAttemptInfo::durationMillis may overflow for slow initial syncs
-
- Backlog
-