On Tue, Mar 18, 2025 at 9:37 AM Alena Rybakina <a.rybak...@postgrespro.ru> wrote: > Sorry, I figured it out. The Assert was added to avoid misuse of the function > to reinitialize memory and to ensure that it happens when parallel_aware is > positive.
Yeah. The assertion is supposed to suggest "don't worry, I didn't forget to test parallel_aware in this function [ExecIndexScanReInitializeDSM or ExecIndexScanReInitializeDSM], it's just that I expect to not be called unless parallel_aware is true". An alternative approach would have been to explicitly handle parallel_aware=false in ExecIndexScanReInitializeDSM and ExecIndexScanReInitializeDSM: they could just return false. That would make ExecIndexScanReInitializeDSM and ExecIndexScanReInitializeDSM more consistent with other nearby functions (in nodeIndexScan.c and nodeIndexOnlyScan.c), at the cost of making the calling code (in execParallel.c) less consistent. I really don't think that that alternative is any better to what I actually did (I actually considered doing things this way myself at one point), though it also doesn't seem worse. So I'm inclined to do nothing about it now. -- Peter Geoghegan