> + UnlockRelationOid(toastrelid, ShareUpdateExclusiveLock);
> + stop_repack_decoding_worker();
>
> Is there any opportunity for another rewrite to sneak in between these
two?

Yes, but it doesn't matter. The old worker is thrown away and nothing has
been copied yet. The new worker reads the relfilenode itself when it
starts, so a rewrite before that is simply what it sees. A rewrite after
that is caught by the next check, which is made under the lock again.

The unlock has to come before starting the new worker anyway, or we
are back to the deadlock.

Thanks,
Shihao

Reply via email to