Skip to content

fix: Repair MySQL online store batch_write path - #6802

Open
karthikchundi-commits wants to merge 1 commit into
feast-dev:masterfrom
karthikchundi-commits:fix/mysql-online-store-batch-write
Open

fix: Repair MySQL online store batch_write path#6802
karthikchundi-commits wants to merge 1 commit into
feast-dev:masterfrom
karthikchundi-commits:fix/mysql-online-store-batch-write

Conversation

@karthikchundi-commits

Copy link
Copy Markdown

What this does

The batch_write path of MySQLOnlineStore.online_write_batch (added in #5699) has two bugs that make it unusable:

  1. config.online_store.bacth_size is a typo for batch_size. MySQLOnlineStoreConfig is a FeastConfigBaseModel with extra="forbid", so:

    • accessing .bacth_size raises AttributeError → enabling batch_write: true crashes before a single row is written;
    • the universal test creator BatchWriteMySQLOnlineStoreCreator passes "bacth_size": "1000" in its config dict, which fails MySQLOnlineStoreConfig validation with Extra inputs are not permitted.
  2. The batch path serializes entity keys with entity_key_serialization_version=2, while the single-row write path and online_read in the same file use version 3. Rows written through the batch path are keyed differently from how they are read, so they cannot be read back. (Version < 3 is also discouraged per RepoConfig.)

Changes

  • mysql.py: bacth_sizebatch_size; batch path entity_key_serialization_version 23 (matching the rest of the file).
  • tests/universal/.../online_store/mysql.py: "bacth_size""batch_size" in BatchWriteMySQLOnlineStoreCreator.
  • New tests/unit/infra/online_store/test_mysql_online_store.py: two mocked-connection unit tests (no live DB) — one asserting the batch path reads batch_size without crashing, one asserting it serializes entity keys with version 3. Both fail on master and pass with this change.

Testing

  • pytest sdk/python/tests/unit/infra/online_store/test_mysql_online_store.py sdk/python/tests/unit/infra/online_store/test_mysql_versioning.py → 13 passed.
  • ruff check / ruff format --check clean; mypy feast/infra/online_stores/mysql_online_store/mysql.py clean.
  • No live MySQL / testcontainers run locally (no Docker in this environment).

Notes

Analysis and drafting were AI-assisted; I have reviewed and tested the change. Unlike postgres.py / sqlite.py, this store hardcodes the serialization version rather than honoring config.entity_key_serialization_version — left as-is to keep this change minimal; happy to follow up.

The `batch_write` branch of `MySQLOnlineStore.online_write_batch` had two
bugs that made it unusable:

- It read `config.online_store.bacth_size` (typo), which raises
  `AttributeError` on the pydantic config, so enabling `batch_write`
  crashed before writing anything.
- It serialized entity keys with `entity_key_serialization_version=2`,
  while the single-row write path and `online_read` in the same file use
  version 3. Rows written via the batch path therefore could not be read
  back.

Fix the field name to `batch_size` and align the batch path on
serialization version 3. Add unit tests (mocked connection, no live
database) covering both.

Note for a follow-up: unlike `postgres.py` / `sqlite.py`, this store
hardcodes the serialization version instead of honoring
`config.entity_key_serialization_version`; left as-is here to keep the
change minimal.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sht1BdriG5qHfkf5aF5gfc
Signed-off-by: Karth <karthik.chundi@gmail.com>
@karthikchundi-commits
karthikchundi-commits requested a review from a team as a code owner September 1, 2026 00:08

@shuchu shuchu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks, let's wait and check the workflow running results.

@shuchu
shuchu self-requested a review September 1, 2026 02:41
@codecov-commenter

codecov-commenter commented Sep 1, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.13%. Comparing base (5ad5592) to head (638b8c0).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6802      +/-   ##
==========================================
+ Coverage   47.08%   47.13%   +0.04%     
==========================================
  Files         419      419              
  Lines       51878    51878              
  Branches     7525     7525              
==========================================
+ Hits        24429    24453      +24     
+ Misses      25700    25672      -28     
- Partials     1749     1753       +4     
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 48.44% <100.00%> (+0.04%) ⬆️
Files with missing lines Coverage Δ
...st/infra/online_stores/mysql_online_store/mysql.py 41.49% <100.00%> (+15.64%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ad5592...638b8c0. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants