Skip to content

Conversation

Torch3333
Copy link
Contributor

@Torch3333 Torch3333 commented Sep 4, 2025

Description

This adds support for TiDB versions 6.5, 7.5, and 8.5, a fully MySQL-compliant database. Connection to TiDB is done through the MySQL Connector/J JDBC driver.

TiDB supports the REPEATABLE_READ and READ_COMMITED transaction isolation level. Since the ScalarDB transaction API sets a SERIALIZABLE isolation level by default not supported by TiDB, users must overwrite it by adding scalar.db.jdbc.isolation_level=REPEATABLE_READ or scalar.db.jdbc.isolation_level=READ_COMMITED to their configuration to use ScalarDB transactional API interfaces.

A sample ScalarDB configuration to use TiDB is as follows.

scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:mysql://localhost:4000/
scalar.db.username=root
scalar.db.password=tidb
# Required if using the transactional API
scalar.db.jdbc.isolation_level=REPEATABLE_READ

Related issues and/or PRs

N/A

Changes made

  • Adds TiDB integration tests to the CI

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

TiDB versions 6.5, 7.5, and 8.5 are now supported as underlying storage by using MySQL Connector/J JDBC driver.

@Torch3333 Torch3333 self-assigned this Sep 4, 2025
@Torch3333 Torch3333 added the enhancement New feature or request label Oct 3, 2025
@Torch3333 Torch3333 marked this pull request as ready for review October 3, 2025 08:05
@Torch3333 Torch3333 requested review from a team, brfrn169, Copilot, feeblefakie and komamitsu and removed request for a team October 3, 2025 08:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds TiDB support to ScalarDB as an underlying storage by enabling connection through MySQL Connector/J JDBC driver. It supports TiDB versions 6.5, 7.5, and 8.5, with configuration to override the default SERIALIZABLE isolation level to REPEATABLE_READ or READ_COMMITTED since TiDB doesn't support SERIALIZABLE.

  • Added isolation level configuration support in JDBC environment setup
  • Implemented TiDB-specific handling for unsupported data types in import tests
  • Added comprehensive CI integration tests for TiDB versions 6.5, 7.5, and 8.5

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcEnv.java Adds isolation level configuration property support for test environment
core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminImportTestUtils.java Implements TiDB detection and specific data type filtering for import tests
.github/workflows/ci.yaml Adds CI integration test jobs for TiDB versions 6.5, 7.5, and 8.5

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@brfrn169
Copy link
Collaborator

brfrn169 commented Oct 7, 2025

Since the ScalarDB transaction API sets a SERIALIZABLE isolation level by default not supported by TiDB

@Torch3333 I don’t think we set the SERIALIZABLE isolation level by default. We only set the isolation level when users specify the scalar.db.jdbc.isolation_level property. What do you think?

@feeblefakie
Copy link
Contributor

@Torch3333 What would happen if users don't specify scalardb.jdbc.isolation_level=REPEATABLE_READ or READ-COMMITTED?

BTW, TiDB seems to be linearizable, independent of isolation levels. So, any isolation levels can probaly be fine for correctness. (cc: @brfrn169 )
https://docs.pingcap.com/tidb/stable/system-variables/#tidb_guarantee_linearizability-new-in-v50

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants