-
Improvement
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
None
Right now, an MBID can only be used once for a certain entity type, but there's nothing preventing us from reusing an existing MBID as another entity type. There's no danger of us running out of MBIDs though, so it would be a bit silly to reuse them.
The way we generate MBIDs currently makes this unlikely to happen (although my understanding is that there's a very very very slim chance that an existing one could still be randomly generated again) but if we're planning to allow some people to submit MBIDs to us (MBS-7885), it's a lot easier for someone to do it by accident.
I haven't entirely thought everything through, so there might be some flaws I haven't considered yet, but the current idea I have in mind is a new "mbid" table with two columns, gid and entity_type. The gid column would be unique and the existing gid columns for entities would have foreign keys to mbid.gid. The entity_type column would make it so that only one entity type can appear in the table and would also mean we can look up the entity type for an MBID more efficiently.
Some discussion on IRC: http://chatlogs.musicbrainz.org/musicbrainz-devel/2015/2015-02/2015-02-19.html#T20-35-55-802533 and http://chatlogs.musicbrainz.org/musicbrainz/2015/2015-02/2015-02-20.html#T15-23-08-125443