Repository navigation
Fixes 35939: Run Doris on PyMySQL and drop unused native libraries from operator images (2.0 backport #35940) - #36052
Conversation
…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.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
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 ✅ 1 closedClosed: Bug: Published image can drop mysqlclient while installed release lacks dialect
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



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
mysqlclientand purgelibmariadb3/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:
libxml2andshared-mime-infostay. 2.0's operator images still install thepostgresql/postgresql-contribserver packages, andpostgresql-17/postgresql-18depend onlibxml2.dpkg --purge libxml2refuses 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. Thelddgate no longer greps forlibxml2.cx_Oraclestays in the import check, because 2.0 still ships it.apt-mark manualline stays where 2.0 has it, minuslibmariadb3 mariadb-common.AUTO_CLASSIFICATION_LANGUAGESblock isn't brought over. It conflicted in, but it comes from a different PR.Rollout: the published
operators/docker/Dockerfileinstallsopenmetadata-ingestion~=${RI_VERSION}from PyPI. An image built from it must use a release that includesdoris/connection.py(the 2.0 release cut after this merges), or Doris loses its DBAPI.Dockerfile.ciinstalls from source and has no such constraint.Type of change:
Tests:
tests/unit/source/database/doris/+tests/unit/topology/database/test_doris.pyagainst 2.0's own generated models: 12 passed.ruff check/ruff format --checkclean.python:3.12-slim-trixie(amd64) container with 2.0's full apt package set and the pgdg postgres install:dpkg --purgeexits 0.src:mariadbpackage survives.libpq5,libpq-dev,libsasl2-2,libxml2andpostgresql-18are still installed.libxml2), the same replay fails:dpkg: error processing package libxml2 ... dependency problems - not removing.lddgates in the Dockerfile enforce this at build time.Checklist:
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge with the stated release constraint.Summary
Doris now uses PyMySQL while keeping
pydorisfor Doris-specific behavior. Both operator Dockerfiles removemysqlclient, MariaDB client libraries, Cyrus SASL plugins, and systemlibrdkafka.Acknowledged constraints from
ulixius9: published images must use an ingestion release containing the driver switch. The decision document also accepts missingmysqlclientinpip checkand incompatibility withmysqlclient-only connection arguments.libxml2remains 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]Reviews (1) · Last reviewed commit: "Fixes 35939: Run Doris on PyMySQL and dr..." · Reviewed by Greptile