dgervalle/xwiki-platform — comment on commit a80fe5de8dd21830aa8ae7fbf74f44e4115bc287
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/migration/hibernate/R32999XWIKI6990DataMigration.java line 120
By sdumitriu:

A problem could be that you might create collisions midway: new id for an old document clashes with the old id of another document. If the uniqueness of the XWD_ID column is respected, then you'll get a database error when trying to update this document. If not, you'll break it when you get to the second document, which will update both documents.

I don't have a solution for this problem yet...

Still, it's not supposed to happen very often, since the old IDs only used half of the available bits, and getting an MD5 hash with lots of zeros is highly improbable.