The UPSERT statement was taking unexplained gap
locks, due to which the import was somehow failing.
I still don't know exactly how this is happening.
But splitting the UPSERT into 2 different statements
in the same transaction changes the locking semantics,
and avoids the deadlock.
Naturally, this proves that even our retrylayer
is sometimes ineffective against some problems.
```release-note
NONE
```