If a driver implements the Lockable interface, then we
already use a manual table lock and hold it until all
the migrations are over. So there's no need to additionally
acquire advisory locks. They are just redundant.
Therefore, we maintain two modes of operation. Either a driver
implements Lockable, in which case we avoid advisory locks.
Or a driver does not do that, in which case we do use advisory locks
to do the locking for us.
It is up to the driver implementor to do as they wish.
There are still some things to sort out from a driver perspective because
logically speaking, we should just remove the advisory lock code. But then,
we break the driver.Driver interface.
Later, one of the things that we can do is compose interfaces into larger ones.
We can keep driver.Driver with just the basic one, and compose a larger one
with driver.Locker and call it driver.DriveLocker or something like that, and
then decide whether to call the global lock or advisory locks from the code.
If a driver implements the Lockable interface, then we already use a manual table lock and hold it until all the migrations are over. So there's no need to additionally acquire advisory locks. They are just redundant.
Therefore, we maintain two modes of operation. Either a driver implements Lockable, in which case we avoid advisory locks. Or a driver does not do that, in which case we do use advisory locks to do the locking for us.
It is up to the driver implementor to do as they wish.
There are still some things to sort out from a driver perspective because logically speaking, we should just remove the advisory lock code. But then, we break the
driver.Driver
interface.Later, one of the things that we can do is compose interfaces into larger ones. We can keep
driver.Driver
with just the basic one, and compose a larger one withdriver.Locker
and call itdriver.DriveLocker
or something like that, and then decide whether to call the global lock or advisory locks from the code.https://mattermost.atlassian.net/browse/MM-41151