Skip to content

HHH-20056 Cascade delete support detection in TiDB#11583

Open
dveeden wants to merge 1 commit intohibernate:mainfrom
dveeden:hhh-20056
Open

HHH-20056 Cascade delete support detection in TiDB#11583
dveeden wants to merge 1 commit intohibernate:mainfrom
dveeden:hhh-20056

Conversation

@dveeden
Copy link
Copy Markdown
Contributor

@dveeden dveeden commented Jan 13, 2026

  1. change supportsCascadeDelete() to detect support based on the TiDB version
  2. change various version related things as we deal with a TiDB version and a MySQL version.

Note that TiDB reports this as version string: 8.0.11-TiDB-v8.5.4. This is TiDB v8.5.4 claiming compatibility with MySQL 8.0.11.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-20056

@hibernate-github-bot
Copy link
Copy Markdown

hibernate-github-bot bot commented Jan 13, 2026

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

@dveeden dveeden force-pushed the hhh-20056 branch 3 times, most recently from df7343c to 0dca6c0 Compare January 20, 2026 10:20

public TiDBDialect(DatabaseVersion version) {
super( version );
this.mySQLVersion = DatabaseVersion.make( 8, 0, 11 );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does TiDB 5.4 advertise itself as MySQL 8.0.11? Maybe this should be a conditional assignment based on the actual behavior of the TiDB major/minor versions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best would be to get this based on the version string, so 8.0.11-TiDB-v7.5.08.0.11.

Another option would be to use 5.7.25 for TiDB < 7.5.0 and 8.0.11 for TiDB >= 7.5.0.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you can use

Suggested change
this.mySQLVersion = DatabaseVersion.make( 8, 0, 11 );
this.mySQLVersion = getVersion().isBefore( 7, 5 ) ? MINIMUM_MYSQL_VERSION : DatabaseVersion.make( 8, 0, 11 );

super( createVersion( info, MINIMUM_VERSION ), MySQLServerConfiguration.fromDialectResolutionInfo( info ) );
super( fetchDataBaseVersion( info ), MySQLServerConfiguration.fromDialectResolutionInfo( info ) );
registerKeywords( info );
this.mySQLVersion = createVersion( info, MINIMUM_VERSION );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be

Suggested change
this.mySQLVersion = createVersion( info, MINIMUM_VERSION );
this.mySQLVersion = createVersion( info, MINIMUM_MYSQL_VERSION );

i.e. the same MINIMUM_MYSQL_VERSION that you set in the other constructor, based on what TiDB 5.4 advertises itself as.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or even this, since createVersion actually uses info.getDatabaseVersion() as a first step.

Suggested change
this.mySQLVersion = createVersion( info, MINIMUM_VERSION );
this.mySQLVersion = info.makeCopyOrDefault( MINIMUM_MYSQL_VERSION );

Copy link
Copy Markdown
Contributor Author

@dveeden dveeden Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • v5.4.3 identifies itself as: 5.7.25-TiDB-v5.4.3
  • v6.1.0 identifies itself as: 5.7.25-TiDB-v6.1.0
  • v7.1.0 identifies itself as: 5.7.25-TiDB-v7.1.0
  • v7.5.0 identifies itself as: 8.0.11-TiDB-v7.5.0
  • v8.1, v8.5 also identify as MySQL 8.0.11

Note that these are LTS versions.

See also:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, you should create private static final DatabaseVersion MINIMUM_MYSQL_VERSION = = DatabaseVersion.make( 5, 7, 25 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants