Skip to content

Add support for TiDB #19655

@bx80

Description

@bx80

After the linked general database abstraction issues have been completed it should be possible to create a new PDO adapter and schema definition to trial running Matomo entirely on TiDB. an open source distributed MySQL compatible database.

This change will allow for long term suitability testing of TiDB as an alternative high-performance database backend for Matomo.

Suggested Approach

  • Create a new PDO adapter core/Db/Adapter/Pdo/Tidb based on core/Db/Adapter/Pdo/Mysql.php.

    • Fully implement all requirements of core/Db/AdapterInterface.
    • Implement getLock() using the approach in the lockalt branch.
    • supportsWindowFunctions() to return true.
    • preferSubqueries() to return true.
    • Create a new OmniFixture dump compatible with the TiDB schema and return it's filename with `getOmniFixtureFilename()'.
    • Check and set the global sql_mode to disable strict grouping operators.
  • Create a new schema class at core/Db/Schema/Tidb

    • Use AUTO_RANDOM Primary keys.
    • Set TiFlash replicas for all log_xxx tables, this may need config settings for clusters with multiple replicas.
    • Create TiDB specific indexes.
    • TEXT columns cannot have default values, remove the defaults.

Related general database abstraction issues:

#19643: Abstract the database get_lock function to PDO adapter
#19646: Support option for ranking queries to use window functions
#19647: Abstract database specific tests and fixture code
#19648: Abstract database specific helper methods to PDO adapter
#19649: Support database specific DDL in migrations
#19650: Use sequences instead of auto increment keys for user facing identifiers
#19651: Support optional sub-query substitution for COUNT(DISTINCT x) queries

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementFor new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions