store: Revert entity versions during copy instead of after by lutter · Pull Request #6472 · graphprotocol/graph-node

@lutter

Reverting entities after copying can be very slow; the step is also
unnecessary since we already know during copying which entity versions need
to be unclamped and we never copy versions that would have to be deleted by
the revert.

We move the revert logic into CopyEntityBatchQuery so that entity versions
are reverted as they are copied rather than in a separate revert_block pass
after copying completes.

The post-copy revert_block call in start_subgraph is kept as a no-op safety
net for copies that were started with older code and resumed after
upgrading. It can be removed once a release with this logic has been out
for long enough.