-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support Flyway for TiDB #19449
Comments
There is another issue with flyway in #15131 (comment) It issues a query |
@nullnotnil Looks that the issue exists for all versions and we should deal with it as well. Thanks! |
I like 2(a) as an initial solution because it is an easy PR to suggest to upstream (handle TiDB the same as PXC). 2(b) Requires more work on upstream, and likely MySQL behavior differences because calling Users will just have to extend the pessimistic lock time to >10minutes if they have long-running DDL. They currently have to extend gc to >10 minutes to create a backup too, so this is not a new problem - I would actually consider the backup one to be more serious. |
I've filed a PR to Flyway: flyway/flyway#2918 |
To be determined, while additional frameworks need to be considered for support. |
This has been added in Flyway 7.11 |
Looks like it is broken for flyway newer than 8.2.1 |
@xyziven Can you give some more details on this? Then we can open a new issue for this if needed. |
Feature Request
Is your feature request related to a problem? Please describe:
Flyway is an open-source framework for database migration. various databases have been supported by it including MySQL and MariaDB.
For now, Flyway reports an error when doing the migration on TiDB:
The error is caused by #14994 (
GET_LOCK
andRELEASE_LOCK
, the "named lock"), by settingset global tidb_enable_noop_functions = 1
, Flyway is able to work with the ignorance of the named lock:Describe the feature you'd like:
Since TiDB aims to be compatible with MySQL, it should be supported by Flyway as well.
Possible solutions:
Close UCP: Support
get_lock
andrelease_lock
functions #14994This is a solution that fits the goals of 'MySQL compatibility', but the implementation is not trivial.
GET_LOCK()
andRELEASE_LOCK()
in MySQL is relying on the 'metadata lock' while there's no such lock in TiDB. After some discussions with @cfzjywxk , we believe that the named lock should be implemented in a similar way like the pessimistic lock, but some details must be handled carefully.For now, we don't treat it as a short-term solution.
Propose an implementation for TiDB in Flyway
By adding a specific implementation for TiDB, we don't have to implement
GET_LOCK()
andRELEASE_LOCK()
. Actually this is the way for some MySQL-based solutions like XtraDB Cluster(Percona XtraDB Cluster support flyway/flyway#1556).Possible implementations:
a) Read/write pessimistic lock, and this is the way XtraDB Cluster works.
Pros: the implementation is simple.
Cons: the pessimistic lock in TiDB is with a TTL, and its default value is [10 minutes[(https://docs.pingcap.com/tidb/stable/tidb-configuration-file#max-txn-ttl). The TTL configuration must be set accordingly with the estimated migration duration.
b) Table lock: *: Support LOCK/UNLOCK TABLES feature #10343
Pros: the implementation is simple, and there is no TTL limitation.
Cons:
UNLOCK TABLE ...
statement. This is why 'table lock' is not public yet.Teachability, Documentation, Adoption, Migration Strategy:
The text was updated successfully, but these errors were encountered: