Darwin is a small Java library that helps applications to setup and evolve their database schema over the time. Evolution is based on SQL patch application and aims at traceability, predictability and reliability. It has been for 13 years in production systems.
Script filenames should always start with patch mode ("create", "patch", "guess") followed by underscore and version separated by dots. This should be used especially when extacting version from filename.
Application tries to remove lock repeatably when lock is no longer valid (not found). It doesn't make sense, because application can't revive from this state.
In case of a restart or application crash is lock left in DB, there is no way to release the lock without waiting for leaseTime to unlock it. A particular lock should maintain information about the node from which it originated, and at the same time the Locker class should provide a way to remove locks from its own node.
Suggested solution:
Locks unlockKey should be stored with postfix: "_{NodeId}".
Locker class should implement method to remove all locks created by particular node (all locks where unlock key ends with "_{NodeId}")
Darwin module should provide interface which will provide identification of Node. This new interface InstanceIdProvider identifies not only a node, but also a specific instance of Locker if multiple instances exist in a single Spring context.
At the end unlockKey might look like "{Hash}{NodeId}{LockerInstanceId}", this will ensure no locks created by other instance of node will be removed.