Skip to content

Add OceanBase MySQL tenant support with extensible mode dispatch - #2

Open
jackysp wants to merge 5 commits into
codex/mysql-prerequisitesfrom
codex/oceanbase-mysql
Open

jackysp wants to merge 5 commits into
codex/mysql-prerequisitesfrom
codex/oceanbase-mysql

Conversation

@jackysp

@jackysp jackysp commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Depends on two standalone MySQL fixes: #926 (generated transactions/schema checking) and #929 (loader error propagation). This PR is temporarily based on codex/mysql-prerequisites so those fixes are excluded from the OceanBase adaptation diff. Retarget to master after the fixes are incorporated into the fork.

Changes

Add an independent OceanBase database category for MySQL-compatible tenants, covering TPROC-C and TPROC-H while retaining the legacy OceanBase option under MySQL. The CLI selects the category with dbset db ob.

Category entry points dispatch generation, counters, options and validation through ob_compatibility_mode. MySQL-specific configuration mapping, login construction and workload integration live in a separate adapter. Existing configurations migrate to mysql; unsupported modes, including oracle, fail explicitly. A future Oracle adapter can reuse the Oracle generators without changing the category entry points.

Reuse the existing MySQL workloads with isolated configuration and tenant-session query timeouts. Add tenant-local OceanBase transaction counters shared by timed TPROC-C and its chart. Adapt H abbreviated-month parsing and case-insensitive table lookup. Generic transaction/schema-check fixes are reviewed separately in TPC-Council#926, and loader error handling in TPC-Council#929. The OceanBase-specific runtime no longer contains the loader error wrapper. Include CLI examples, migration support and regression tests. Empty optional fields are supplied by an OceanBase-only configuration normalizer; the shared XML parser is unchanged. Offline C/H data generation obtains its format from the selected tenant adapter through a prefix-based callback.

Validation

Tested with the v6.0 runtime on Linux x86-64 against OceanBase Enterprise 4.3.5.6 and OBProxy 4.4.1.0:

  • TPROC-C: two-warehouse build/check, direct and proxy calls, prepared and non-procedure calls, timed results, and post-run consistency checks. The initial implementation suite executed 20,000 basic calls; the mode-dispatch refactor passed another 4,000 non-procedure calls.
  • TPROC-H: SF1 build including statistics, all 22 queries, RF1/queries/RF2 through OBProxy, and final consistency checks. All 22 queries passed again after the mode-dispatch refactor.
  • 29 helper/generated-driver assertions passed, including a test-only second backend to verify dispatch independently of MySQL. Actual CLI tests covered C/H counter polling, failed authentication, configuration migration, and rejection of Oracle mode before generation.

OB TPM includes other activity in the same tenant and is not directly equivalent to MySQL statement counters. These runs validate compatibility, not performance.

Offline data-generation regression also passed on AWS: one C warehouse (9 files) and H SF1 (8 files, 1,500,000 orders and 5,998,868 line items), with table row counts and MySQL date-time formatting checked. Fresh and persisted OceanBase defaults and rejection of unsupported Oracle data generation passed.

Remaining validation

Complete GUI startup, Windows execution, TLS, native MySQL server regression, large/multi-node schemas and schema deletion remain unverified. The Linux GUI test was blocked by the repackaged runtime's embedded console initialization. The bundled Linux MySQL client emitted a non-fatal character-set 45 warning during statistics collection; schema and consistency checks passed.

This PR targets oceanbase/HammerDB:codex/mysql-prerequisites for review in our fork. It does not implement Oracle tenant support or claim complete cross-platform validation.

Copilot AI lite review requested due to automatic review settings September 14, 2026 11:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved critical login-command injection and three moderate SQLite persistence findings remain.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds an independent OceanBase category for MySQL-compatible tenants, reusing MySQL workloads with tenant-specific configuration, counters, timeouts, and data generation.

Changes:

  • Adds OceanBase backend dispatch, adapter configuration, and migration support.
  • Extends workloads with tenant counters, timeouts, and format routing.
  • Adds CLI examples, documentation, and regression tests.
File summaries
File Reviewed change Final review comment
tests/oceanbase.tcl OceanBase runtime and dispatch tests.
tests/oceanbase-generated.tcl Generated-driver regression tests.
src/oceanbase/obotc.tcl Transaction counter dispatch.
src/oceanbase/obopt.tcl Backend registry and category dispatch.
src/oceanbase/oboltp.tcl TPROC-C dispatch entry points.
src/oceanbase/obolap.tcl TPROC-H dispatch entry points.
src/oceanbase/obmet.tcl Metrics integration boundary.
src/oceanbase/obci.tcl CI integration boundary.
src/oceanbase/mysql/adapter.tcl Maps tenant configuration to MySQL workloads. Critical (1 vote): User-controlled login components are inserted unquoted into generated Tcl; quote generated arguments or validate the exact identifier grammar.
src/mysql/mysqlotc.tcl Shared counter and timeout integration.
src/mysql/mysqloltp.tcl Session setup and transaction reporting.
src/mysql/mysqlolap.tcl TPROC-H parsing and schema compatibility updates.
src/generic/geninitws.tcl Web-service configuration initialization. Moderate (1 vote): SQLite handles remain open, preventing normalized configuration from being persisted and causing defaults to reapply on startup.
src/generic/geninitcli.tcl CLI configuration initialization. Moderate (1 vote): SQLite handles remain open, preventing normalized configuration from being persisted and causing defaults to reapply on startup.
src/generic/geninit.tcl GUI configuration initialization. Moderate (1 vote): SQLite handles remain open, preventing normalized configuration from being persisted and causing defaults to reapply on startup.
src/generic/gengen.tcl Backend-aware data-format resolution.
scripts/tcl/oceanbase/mysql/tproch.tcl OceanBase TPROC-H workflow.
scripts/tcl/oceanbase/mysql/tprocc.tcl OceanBase TPROC-C workflow.
scripts/tcl/oceanbase/mysql/config.tcl Shared OceanBase CLI configuration.
modules/oceanbaseconfig-1.0.tm OceanBase configuration normalization.
modules/mysqlcommon-1.0.tm Shared MySQL/OceanBase runtime helpers.
modules/jobs-1.0.tm OceanBase chart colors.
DocBook/oceanbase-mysql.md OceanBase tenant documentation.
config/oceanbase.xml OceanBase defaults and options.
config/database.xml OceanBase category registration.
Review details

Suppressed comments (3)

src/generic/geninit.tcl:104

  • When an existing SQLite configuration is loaded, SQLite2Dict leaves the global hdb command open (src/generic/genxml.tcl:186-214). Dict2SQLite then tries to create hdb again, catches the duplicate-command error, and returns without writing, so this normalization is only in memory and the defaults are re-applied on every GUI startup. Please make the shared SQLite read/write path reuse or close the handle before relying on this persistence call.
            Dict2SQLite $key $dbconfdict

src/generic/geninitcli.tcl:100

  • When an existing SQLite configuration is loaded, SQLite2Dict leaves the global hdb command open (src/generic/genxml.tcl:186-214). Dict2SQLite then tries to create hdb again, catches the duplicate-command error, and returns without writing, so this normalization is only in memory and the defaults are re-applied on every CLI startup. Please make the shared SQLite read/write path reuse or close the handle before relying on this persistence call.
            Dict2SQLite $key $dbconfdict

src/generic/geninitws.tcl:100

  • When an existing SQLite configuration is loaded, SQLite2Dict leaves the global hdb command open (src/generic/genxml.tcl:186-214). Dict2SQLite then tries to create hdb again, catches the duplicate-command error, and returns without writing, so this normalization is only in memory and the defaults are re-applied on every web-service startup. Please make the shared SQLite read/write path reuse or close the handle before relying on this persistence call.
            Dict2SQLite $key $dbconfdict
  • Files reviewed: 25/25 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

set tenant [dict get $config connection ob_tenant]
set cluster [dict get $config connection ob_cluster]
foreach {group key} {tpcc user tpch tpch_user} {
dict set mapped $group mysql_$key [username [dict get $config $group ob_$key] $tenant $cluster]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants