The code currently assumes that once a block file is 'left', it and its corresponding rev file can be flushed, and won't be written to any further.

https://github.com/bitcoin/bitcoin/blob/e8e79958a7b2a0bf1b02adcce9f4d811eac37dfc/src/validation.cpp#L1742-L1743

(Flushing here additionally means to get rid of pre-allocated unused space.)

This is the case for the bl(oc)k files, but it turns out to not be the case for the rev files. During an IBD up to ~200k blocks, the following excerpt (one of several) was encountered (grepping out irrelevancy):
```
[...]
2020-01-07T14:19:09Z Pre-allocating up to position 0x7000000 in blk00013.dat
2020-01-07T14:19:13Z Pre-allocating up to position 0x8000000 in blk00013.dat
2020-01-07T14:19:14Z Pre-allocating up to position 0xf00000 in rev00013.dat
2020-01-07T14:19:16Z Leaving block file 13: CBlockFileInfo(blocks=1099, size=134068483, heights=183531...185655, time=2012-06-08...2012-06-22)
2020-01-07T14:19:16Z Pre-allocating up to position 0x1000000 in blk00014.dat
2020-01-07T14:19:17Z Pre-allocating up to position 0x100000 in rev00014.dat
2020-01-07T14:19:20Z Pre-allocating up to position 0x1000000 in rev00013.dat
2020-01-07T14:19:20Z Pre-allocating up to position 0x2000000 in blk00014.dat
2020-01-07T14:19:24Z Pre-allocating up to position 0x1100000 in rev00013.dat
2020-01-07T14:19:26Z Pre-allocating up to position 0x3000000 in blk00014.dat
2020-01-07T14:19:27Z Pre-allocating up to position 0x1200000 in rev00013.dat
2020-01-07T14:19:30Z Pre-allocating up to position 0x200000 in rev00014.dat
2020-01-07T14:19:33Z Pre-allocating up to position 0x300000 in rev00014.dat
2020-01-07T14:19:35Z Pre-allocating up to position 0x400000 in rev00014.dat
2020-01-07T14:19:37Z Pre-allocating up to position 0x500000 in rev00014.dat
2020-01-07T14:19:39Z Pre-allocating up to position 0x600000 in rev00014.dat
2020-01-07T14:19:42Z Pre-allocating up to position 0x700000 in rev00014.dat
2020-01-07T14:19:43Z Pre-allocating up to position 0x4000000 in blk00014.dat
2020-01-07T14:19:45Z Pre-allocating up to position 0x800000 in rev00014.dat
2020-01-07T14:19:49Z Pre-allocating up to position 0x900000 in rev00014.dat
[...]
```

But the only time we flush (and truncate the files to their correct size) is when we leave a block, and we already left block 13 here, so the rev files above end up with pre-allocated space that is never used. This is related to #17827.

This seems to repeat itself for every file that ended up larger than expected in https://github.com/bitcoin/bitcoin/pull/17887#issuecomment-571591432. (Note: #17887 is not a fix for this issue. #17887 makes the impact much smaller by fixing a separate blow-up bug, but it does not address re-flushing re-opened rev files.)

nTime3 = GetTimeMicros(); nTimeConnectTotal += nTime3 - nTime2;
        assert(nBlocksTotal > 0);
        LogPrint(BCLog::BENCH, "  - Connect total: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime3 - nTime2) * MILLI, nTimeConnectTotal * MICRO, nTimeConnectTotal * MILLI / nBlocksTotal);
        bool flushed = view.Flush();
        assert(flushed);
    }
    int64_t nTime4 = GetTimeMicros(); nTimeFlush += nTime4 - nTime3;
    LogPrint(BCLog::BENCH, "  - Flush: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime4 - nTime3) * MILLI, nTimeFlush * MICRO, nTimeFlush * MILLI / nBlocksTotal);
    
    if (!FlushStateToDisk(chainparams, state, FlushStateMode::IF_NEEDED))
        return false;
    int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4;
    LogPrint(BCLog::BENCH, "  - Writing chainstate: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime5 - nTime4) * MILLI, nTimeChainState * MICRO, nTimeChainState * MILLI / nBlocksTotal);
    
    mempool.removeForBlock(blockConnecting.vtx, pindexNew->nHeight);
    disconnectpool.removeForBlock(blockConnecting.vtx);
    
    m_chain.SetTip(pindexNew);
    UpdateTip(pindexNew, chainparams);
    int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
    LogPrint(BCLog::BENCH, "  - Connect postprocess: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime5) * MILLI, nTimePostConnect * MICRO, nTimePostConnect * MILLI / nBlocksTotal);
    LogPrint(BCLog::BENCH, "- Connect block: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime6 - nTime1) * MILLI, nTimeTotal * MICRO, nTimeTotal * MILLI / nBlocksTotal);
    connectTrace.BlockConnected(pindexNew, std::move(pthisBlock));
    return true;
}
/**
 * Return the tip of the chain with the most work in it, that isn't
 * known to be invalid (it's however far from certain to be valid).
 */
CBlockIndex* CChainState::FindMostWorkChain() {