migrate
migrate copied to clipboard
SQL Server Driver Attempts to Release Nonexistent Locks
Describe the Bug When calling WithInstance (https://github.com/golang-migrate/migrate/blob/master/database/sqlserver/sqlserver.go#L59) to construct the SQL Server driver, sometimes calls to ensureVersionTable (https://github.com/golang-migrate/migrate/blob/master/database/sqlserver/sqlserver.go#L311) result in the lock Release being attempted, but there is no underlying lock.
I suspect there might be a more complex interaction somewhere I haven't yet been able to identify, such as how SQL Server handles locks. But at present it seems that there should be a graceful behaviour where the library accepts that the lock was released on the RDB side, and gracefully return and continue?
I'm not sure exactly what the best approach here is though, and am mostly trying to share what I've been able to determine thusfar.
For context, the MS SQL Server version we are using is the 2017 one provided via the mcr.microsoft.com/mssql/server:2017-latest docker container.
Expected Behavior A clear and concise description of what you expected to happen.
Migrate Version v4.4.0
Loaded Database Drivers github.com/denisenkom/go-mssqldb
Go Version go1.12 darwin/amd64