Skip to content

Fixes 35939: Run Doris on PyMySQL and drop unused native libraries from operator images (2.0 backport #35940) - #36052

Merged
ulixius9 merged 1 commit into
2.0from
backport-35940-2.0
Oct 23, 2026
Merged

ulixius9 merged 1 commit into
2.0from
backport-35940-2.0

Conversation

@ulixius9

@ulixius9 ulixius9 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Backport of #35940 to 2.0 (cherry-picked with -x). Fixes #35939.

Doris now connects through PyMySQL, so the operator images uninstall mysqlclient and purge libmariadb3/mariadb-common, which carry 26 High/Critical MariaDB server CVEs. The images also purge the Cyrus SASL plugins and librdkafka. See #35940 for the full design.

What differs from main:

  • libxml2 and shared-mime-info stay. 2.0's operator images still install the postgresql / postgresql-contrib server packages, and postgresql-17/postgresql-18 depend on libxml2. dpkg --purge libxml2 refuses to remove it and fails the build. Main stopped installing those packages in build(ingestion): trim runtime dependencies and update clients #35445, which isn't on 2.0. So the 7 libxml2 findings stay open on this branch. The ldd gate no longer greps for libxml2.
  • cx_Oracle stays in the import check, because 2.0 still ships it.
  • The apt-mark manual line stays where 2.0 has it, minus libmariadb3 mariadb-common.
  • The AUTO_CLASSIFICATION_LANGUAGES block isn't brought over. It conflicted in, but it comes from a different PR.

Rollout: the published operators/docker/Dockerfile installs openmetadata-ingestion~=${RI_VERSION} from PyPI. An image built from it must use a release that includes doris/connection.py (the 2.0 release cut after this merges), or Doris loses its DBAPI. Dockerfile.ci installs from source and has no such constraint.

Type of change:

  • Improvement

Tests:

  • tests/unit/source/database/doris/ + tests/unit/topology/database/test_doris.py against 2.0's own generated models: 12 passed.
  • ruff check / ruff format --check clean.
  • Purge layer replayed in a python:3.12-slim-trixie (amd64) container with 2.0's full apt package set and the pgdg postgres install:
    • dpkg --purge exits 0.
    • No src:mariadb package survives.
    • libpq5, libpq-dev, libsasl2-2, libxml2 and postgresql-18 are still installed.
    • With main's list (including libxml2), the same replay fails: dpkg: error processing package libxml2 ... dependency problems - not removing.
  • Not run: a full operator image build. The MariaDB, import and ldd gates in the Dockerfile enforce this at build time.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge with the stated release constraint.

Summary

Doris now uses PyMySQL while keeping pydoris for Doris-specific behavior. Both operator Dockerfiles remove mysqlclient, MariaDB client libraries, Cyrus SASL plugins, and system librdkafka.

  • Doris connections keep their URL and switch to the PyMySQL driver.
  • Operator images drop the MariaDB client and selected unused native libraries.

Acknowledged constraints from ulixius9: published images must use an ingestion release containing the driver switch. The decision document also accepts missing mysqlclient in pip check and incompatibility with mysqlclient-only connection arguments. libxml2 remains because this branch still installs PostgreSQL server packages.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[DorisConnection] --> B[SQLAlchemy doris registry]
  B --> C[DorisPyMySQLDialect]
  C --> D[pydoris reflection]
  C --> E[PyMySQL connection]
Loading

Reviews (1) · Last reviewed commit: "Fixes 35939: Run Doris on PyMySQL and dr..." · Reviewed by Greptile

…om operator images (#35940)

* Run the Doris connector on PyMySQL and drop MariaDB from the operator images

pydoris builds on SQLAlchemy's mysqldb dialect, so the operator (ingestion-base)
images shipped mysqlclient and, through it, Debian's libmariadb3 and
mariadb-common. Those two packages carry every MariaDB server CVE (26
High/Critical findings in the 2.0.6 runner scan) although no server is
installed. Doris was the only runtime consumer: every other MySQL-family
connector already uses PyMySQL.

Register a pydoris dialect on PyMySQL for the doris:// scheme, uninstall
mysqlclient in the operator images, purge the MariaDB client packages and fail
the build if any src:mariadb binary survives. The Airflow image keeps
mysqlclient for its own mysql+mysqldb metadata database.

ADR:2026-10-22-doris-connects-through-pymysql-and-images-ship-no-mariadb-client

* Purge libxml2, the Cyrus SASL plugins and librdkafka from the operator images

Debian files 10 more High findings in the 2.0.6 runner scan against packages
nothing in the image loads, with no trixie fix: libxml2 (7; lxml bundles its
own), libsasl2-dev/-modules/-modules-gssapi-mit (3; Hive and Impala use
pure-sasl + kerberos, and the confluent_kafka wheel bundles its own
librdkafka). libsasl2-2 and its sasldb plugin stay for libpq5 -> libldap2;
the DIGEST-MD5 plugin the SASL CVE is in leaves with libsasl2-modules.

dpkg --purge refuses to remove a package something still depends on, where
apt-get -y would remove the dependent silently. A new build step fails if
any native library under site-packages, /opt or /instantclient links one
of the purged libraries.

* Suppress pydoris's inherited reflection-signature mismatch in the PyMySQL Doris dialect

basedpyright (py3.10 static checks) flags 10 reportIncompatibleMethodOverride
errors on DorisPyMySQLDialect: pydoris's DorisDialect declares untyped
reflection methods that clash with SQLAlchemy 2.0's typed MySQLDialect ones.
pydoris's methods are meant to win in the MRO, so the mismatch is inherited,
not ours to fix.

(cherry picked from commit 2765a37)

2.0 backport note: libxml2 and shared-mime-info are not purged here. 2.0's
operator images still install the postgresql server packages, which depend on
libxml2, so dpkg --purge would fail the build (that install was trimmed on main
by #35445). cx_Oracle stays in the import check because 2.0 still ships it.
@ulixius9
ulixius9 requested a review from a team as a code owner October 23, 2026 04:50
@ulixius9
ulixius9 requested review from stout-yeoman and removed request for a team October 23, 2026 04:50
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 23, 2026
Comment thread ingestion/operators/docker/Dockerfile Resolved
@gitar-bot

gitar-bot Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Switching Doris to PyMySQL and purging native drivers changes compatibility; mismatched ingestion releases or remaining dependencies could break Doris connections or workloads.

Runs Doris on PyMySQL and removes mysqlclient plus the unused MariaDB, Cyrus SASL, and librdkafka libraries from operator images to clear 26 High/Critical MariaDB CVEs. Changes requested: the published operators/docker/Dockerfile installs openmetadata-ingestion~=${RI_VERSION} from PyPI, and RI_VERSION still defaults to 2.0.6.0. If that release predates DorisPyMySQLDialect, doris:// falls back to the mysqldb dialect and fails at runtime with ModuleNotFoundError: MySQLdb. No build gate catches this, so a build-time assertion that doris:// resolves to the PyMySQL driver should be added.

✅ 1 closed
Closed: Bug: Published image can drop mysqlclient while installed release lacks dialect

📄 ingestion/operators/docker/Dockerfile:184-188 📄 ingestion/operators/docker/Dockerfile:301
ingestion/operators/docker/Dockerfile installs openmetadata-ingestion~=${RI_VERSION} from PyPI. RI_VERSION still defaults to 2.0.6.0 (line 170), and this layer now always runs pip uninstall -y mysqlclient. The PR description says Doris only works on a release that ships DorisPyMySQLDialect. If RI_VERSION resolves to a release from before this change, doris:// falls back to pydoris's mysqldb dialect, and every Doris connection fails at runtime with ModuleNotFoundError: MySQLdb. No build gate catches this: the import check dropped MySQLdb, and the ldd check only looks for missing shared libraries. A cheap build-time assertion that doris:// resolves to the PyMySQL driver would fail the build instead of shipping a broken connector.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

@ulixius9
ulixius9 merged commit f6ce0e8 into 2.0 Oct 23, 2026
72 of 75 checks passed
@ulixius9
ulixius9 deleted the backport-35940-2.0 branch October 23, 2026 08:13

This branch was previously deployed

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

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants