Skip to content

feat: Add Bigtable online store support for the Go feature server - #7193

Open
timsmallwood wants to merge 1 commit into
feast-dev:masterfrom
timsmallwood:feat/go-bigtable-online-store
Open

timsmallwood wants to merge 1 commit into
feast-dev:masterfrom
timsmallwood:feat/go-bigtable-online-store

Conversation

@timsmallwood

@timsmallwood timsmallwood commented Nov 20, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it:

Adds a read-only Bigtable online store to the Go feature server. It reads the tables Python's
feast materialize writes, with no data migration, and takes the same online_store section of
feature_store.yaml. The defaults and tuning settings are there to keep read latency low at high request
rates; why they are what they are is below. It also adds two optional Python settings on the table side,
initial_tablets (pre-split new tables) and write_app_profile (keep materialization off the serving app
profile), described under "Python config".

What it reads:

  • Table <project>.<sorted entity names joined by "-">, with Python's md5 shortening and __dummy for
    entityless views. Row key hex(murmur3_x64_128(entity key v3, seed 0)) + "#" + feature_view. Family
    features, one qualifier per feature, plus event_ts.
  • One ReadRows per chunk of keys_per_request row keys, up to max_concurrent_chunks in flight per read,
    and optionally at most max_inflight_reads across the server, reserved per read before it sends anything.
    The first failing chunk cancels the rest.
  • Filter: the requested qualifiers plus event_ts, each regexp.QuoteMeta-escaped, chained with
    LatestNFilter(1), so it returns the newest version Python returns whatever max_versions is.
  • Missing row: NOT_FOUND with a zero timestamp. Row present, feature absent: NOT_FOUND with the row's
    timestamp. A corrupt cell or a missing event_ts fails the read with an error naming the table, view and
    qualifier; it is never served as missing data.
  • One client per store, closed in Destruct(). Outside the emulator the client library already primes its
    connections with PingAndWarm when it is created (three attempts each), so bad credentials fail startup
    there. The store then pings once more, within 10 s: that gives the emulator and pre-dialed connections,
    which skip priming, the same check, and it logs a warning for NotFound, which the library treats as a
    successful prime and logs only at debug level. NotFound comes from an instance with no tables yet but
    also from a mistyped instance or app profile, so the warning is the one visible sign of the latter.
    Unimplemented from an old emulator also only warns. The serving identity needs bigtable.instances.ping
    and bigtable.tables.readRows, both in roles/bigtable.reader. An unset project_id falls back to
    GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECT, then the default credentials' project.
  • read_timeout_ms bounds each read, including retries and any wait for slots. A bigtable.OnlineRead span,
    like the Redis store's, and three Prometheus series on the existing metrics port: read duration by
    status (ok, error, rejected), and chunks sent and rows found by table. Nothing in the Go server
    measures online store reads today, so they are per store, with a feast_bigtable_ prefix; table is
    bounded by the project's entity sets. I can rename them or move them to a shared scheme if you prefer.

Limits, the same as the other Go stores: join keys STRING, BYTES, INT32 or INT64. The HTTP endpoint types
entity values by their JSON form, so BYTES and INT32 keys are found only through gRPC; the docs now say so.
entity_key_serialization_version must be 3 (omitted means 3).

Why OnlineRead returns an error

Bigtable tables are named after a feature view's entities, which OnlineRead's arguments don't carry: entity
keys carry join keys, which can differ from entity names. Rather than change OnlineRead for every store,
this adds an optional EntityAwareOnlineStore interface. readFromOnlineStore uses it when a store
implements it, passing entity names from the request's own feature view snapshot, the one GroupFeatureRefs
built the entity keys from. That keeps stream views' precedence over batch views of the same name, and a
registry refresh mid-request can't mix schemas; TestStreamViewWinsForEntityAwareStore covers it.

OnlineRead stays only to satisfy OnlineStore. It returns an error wrapping errors.ErrUnsupported, and
the feature server never calls it for Bigtable. I considered having the store look up entities in the
registry, but no other store depends on the registry, and its view could disagree with the request's.
Widening OnlineRead for all stores would also work if maintainers prefer one interface; it is a mechanical
follow-up. The OnlineStore interface and the other stores are unchanged.

Defaults and why

Setting Default Why
keys_per_request 5 In benchmarks, a ReadRows of many keys took longer than the same keys as several small requests in parallel, so small chunks cut latency.
max_concurrent_chunks 50 Chunks wait on Bigtable, not CPU, so this is a fixed number rather than a multiple of GOMAXPROCS.
read_timeout_ms 60000 A ceiling that stops the client retrying without end, not a latency target. The docs recommend setting it near the serving target.
max_inflight_reads unset No server-wide limit on concurrent ReadRows calls. The docs say how to size it.
max_inflight_wait_ms 0 With the cap full, reject at once rather than queue. 10 to 20 absorbs bursts.
adaptive_chunking false Opt-in; see below.

These favor latency on an instance with many nodes. In our load tests, reading a 50-entity or 500-entity
request as small chunks in parallel gave a much lower p99 than sending it as one large ReadRows. The cost
is Go CPU: each chunk is a call, so at very high request rates larger chunks carry less load per pod. The
docs say what to change on a small instance: raise keys_per_request, lower max_concurrent_chunks, set
max_inflight_reads. I can share the benchmark harness and results if that helps review.

  • adaptive_chunking: true keeps keys_per_request as the smallest chunk and grows chunks, up to 100 keys,
    only when a read would not fit one round of max_concurrent_chunks. For a single-table read, 500 row keys
    go out as 50 calls of 10 rather than 100 calls of 5 in two rounds; each table is cut separately, so a read
    over several tables can plan a few more calls, which wait for a slot. It never makes chunks smaller than
    configured.
  • max_inflight_reads is a server-wide weighted semaphore. A read reserves all its slots (the smallest of its
    chunk count, max_concurrent_chunks and the cap) before it sends anything, so a full server rejects whole
    reads rather than cancelling chunks already at Bigtable. A read that cannot get its slots within
    max_inflight_wait_ms fails with RESOURCE_EXHAUSTED over gRPC (500 over HTTP, which maps every error to
    500 today) and counts as status="rejected". Rejecting early is meant to keep admitted reads inside their
    deadline under overload, instead of every read slowing until read_timeout_ms fails it;
    read_timeout_ms stays the last bound.
  • Bigtable's in-memory tier serves only single-row point reads. The docs give the settings that let this
    store use it (keys_per_request: 1, adaptive_chunking off, an app profile set up for the tier); it
    needs no code of its own.
  • disable_metrics: true turns off the client's Cloud Monitoring export: no monitoring.timeSeries.create
    permission needed, and noticeably less Go CPU in our load tests.

Python config

FeastConfigBaseModel sets extra="forbid", so every key the Go server reads must exist on
BigtableOnlineStoreConfig, or feast apply rejects the shared file. This adds the Go settings as optional
fields, all None by default and ignored by Python: keys_per_request (1 to 100), max_concurrent_chunks,
read_timeout_ms, max_inflight_reads, max_inflight_wait_ms, adaptive_chunking and disable_metrics.
The numeric ones are strict ints up to 2147483647 and the switches strict bools, as the Go server parses
them, so feast apply rejects a quoted "25" or a boolean instead of the Go server failing at startup.
app_profile is used by both: the Go server's reads and, now, Python's online reads.

Two Python settings protect serving latency from the table side, each off unless set, so an existing
feature_store.yaml behaves as before:

  • initial_tablets (2 to 256): feast apply creates new tables pre-split at even two-hex-digit prefixes. Row
    keys start with a uniform hash, so tablets fill evenly. A new table starts as one tablet, and Bigtable can
    keep a small table on one tablet, so every read of it lands on one node. In our load tests, small
    unsplit tables left one node far busier than the rest, and pre-splitting them removed that hot spot and
    the tail latency it caused. As a rule of thumb, the docs suggest a few tablets per node at the
    target node count. Existing tables are untouched; the docs give the cbt equivalent.
  • write_app_profile: the app profile for materialization and push, so writes can run at low priority and
    not compete with serving reads. It does not fall back to app_profile, so setting app_profile for
    serving never moves writes onto the serving profile.

Parity with Python

  • testdata/bigtable_fixtures.json comes from gen_bigtable_fixtures.py, which calls the in-tree Python
    store: _get_table_name, _compute_row_key, and _write_rows_to_bt through a table stand-in that records
    the cells. test_bigtable_go_fixtures.py regenerates them and fails if they differ from the committed file,
    so a change to the Python writer cannot leave the Go tests passing on stale fixtures.
  • Covered: negative ints, UTF-8, bytes, multi-key ordering, md5 shortening (including Python's clamp at 32 hex
    chars), entityless views, every event_ts form isoformat() writes, and the murmur3 byte order for input
    lengths 1 to 100.
  • The hash is github.com/spaolacci/murmur3 (tagged v1.1.0, already in go.mod for the Redis store's 32-bit
    hash). The DynamoDB store computes the same 128-bit hash with github.com/roberson-io/mmh3, an untagged
    2019 pseudo-version; I kept to the tagged module, and the 100 fixture vectors pin byte equality with
    Python's mmh3. A shared helper for both stores would be a small follow-up.
  • End to end: TestBigtablePythonMaterializeGoRead (go/internal/feast) runs the Python SDK's feast apply
    and feast materialize-incremental on the Go test repo against a bttest server, then reads it back
    through FeatureStore.GetOnlineFeatures and checks values, event timestamps and NOT_FOUND against the
    parquet source. It needs the feast CLI with the gcp extra and skips without it, so the unit-test-go
    job now installs .[gcp] (one added step in unit_tests.yml, easy to drop if you'd rather not).

go.mod

One new direct module, cloud.google.com/go/bigtable v1.58.0 (needs Go 1.26, Feast's version). Three modules
already in the graph move from indirect to direct at the same versions: golang.org/x/oauth2 (default
credentials project), google.golang.org/api (client options) and github.com/prometheus/client_model
(metrics test). New indirect: longrunning, google/btree, kylelemons/godebug, rsc.io/binaryregexp.
No existing dependency changes version.

Also: .pre-commit-config.yaml excludes the fixtures JSON from detect-secrets (hex hashes and serialized
protos), go/README.md and the architecture skill doc mention the store, and the feature_store.yaml
reference links each online store's options page.

Which issue(s) this PR fixes:

Closes #7192

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Unit tests (bttest in-memory server, no network):

  • 51 Bigtable tests in onlinestore: parity, missing rows and features, old cell versions, corrupt cells,
    regex metacharacters in feature names, the read filter chain, duplicate keys, the same feature in two
    views, chunk boundaries, adaptive sizing, per-read concurrency, server-wide admission with and without a
    wait (mostly channel gates rather than sleeps), cancellation and timeouts, startup ping answers, project
    resolution, config parsing and validation, metrics.
  • 3 tests in featurestore_test.go for the entity-aware dispatch, including stream-view precedence, and the
    end-to-end test above in featurestore_bigtable_test.go.
  • go test -race -count=2 passes for the Bigtable tests; go test -short skips the one heavy concurrency
    test. gofmt, go vet and go mod tidy -diff are clean.
  • Python: 66 tests across test_bigtable_online_store.py and test_bigtable_go_fixtures.py; ruff and
    mypy clean.

Integration tests: not run. The suite needs ok-to-test (request below).

Manual, real cloud: on GKE, Python materialized a 12-feature view to Bigtable and the Python feature
server and this store served it side by side: 2,000 entities x 12 features, 0 value mismatches and 0
event_ts mismatches in 24,000 cells. (That manual test predates later changes to defaults and config;
the read encoding is unchanged and the parity fixtures pin it.)

Misc

CI's Go tests run with -skip "TestGetOnlineFeatures|TestSqliteOnlineRead", which is unanchored, so the new
stream-view test is named TestStreamViewWinsForEntityAwareStore to keep it running.

Could a maintainer add ok-to-test? This touches featurestore.go and the Python config model, so I'd like
the integration suite green before review. Thanks.


Devin Review

@timsmallwood
timsmallwood requested a review from a team as a code owner November 20, 2026 18:24

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Add a read-only Bigtable online store to the Go feature server. It reads
the tables Python's `feast materialize` writes, with no data migration,
and takes the same `online_store` section of feature_store.yaml.

- Table `<project>.<sorted entity names joined by "-">` with Python's md5
  shortening, row key hex(murmur3_x64_128(entity key v3)) + "#" +
  feature view, family `features`, one qualifier per feature plus
  `event_ts`.
- Reads are split into chunks of `keys_per_request` row keys (default 5),
  up to `max_concurrent_chunks` per read (default 50), each a ReadRows
  filtered to the requested qualifiers and LatestNFilter(1).
  `read_timeout_ms` (default 60 s) bounds each read, including retries.
- Optional `max_inflight_reads` caps ReadRows calls across the server.
  A read reserves all the slots it needs before it sends anything, and
  is rejected (RESOURCE_EXHAUSTED over gRPC, 500 over HTTP) when they
  are not free within `max_inflight_wait_ms` (default 0, reject at
  once), so an overloaded server sheds whole reads instead of queueing
  them until they time out.
- Optional `adaptive_chunking` keeps `keys_per_request` as the smallest
  chunk and grows chunks, up to 100 keys, so a large read goes out in one
  round.
- Optional `disable_metrics` turns off the client's Cloud Monitoring
  export. A `bigtable.OnlineRead` span and Prometheus series for read
  duration, chunks sent and rows found.
- Add the optional EntityAwareOnlineStore interface: readFromOnlineStore
  passes each view's entity names from the request's own view snapshot,
  so stream views keep precedence. OnlineRead returns an error wrapping
  errors.ErrUnsupported. The OnlineStore interface and the other stores
  are unchanged.
- After the client primes its connections, startup pings the instance
  once more, so the emulator gets the same check and NotFound (no
  tables yet, or a mistyped instance) logs a warning; on an emulator,
  Unimplemented also only warns. An unset project_id falls back to
  GOOGLE_CLOUD_PROJECT, GCLOUD_PROJECT, then the default credentials'
  project.
- Python: accept the Go settings in BigtableOnlineStoreConfig so one
  feature_store.yaml serves both; Python online reads use `app_profile`;
  add `write_app_profile` (keeps writes off the serving profile) and
  `initial_tablets` (pre-split new tables so a small table is not served
  by one node), each off unless set. The numeric Go settings are strict
  ints up to MaxInt32, as the Go server parses them, so `feast apply`
  rejects what the Go server would.
- Parity fixtures are generated from the in-tree Python store, and a
  Python unit test fails when they drift. An end-to-end Go test has the
  Python SDK apply and materialize into the Bigtable emulator, then
  reads it back through GetOnlineFeatures; CI's Go job installs the gcp
  extra for it.
- Docs for the Go reader and the new Python settings, linked from the
  feature_store.yaml reference.

Signed-off-by: Timothy Smallwood <timsmallwood@gmail.com>
@timsmallwood
timsmallwood force-pushed the feat/go-bigtable-online-store branch from 4ba890e to b377218 Compare November 20, 2026 19:23
@codecov-commenter

Copy link
Copy Markdown

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

Codecov Report

❌ Patch coverage is 94.68085% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.17%. Comparing base (1d6cfb4) to head (b377218).

Files with missing lines Patch % Lines
.../internal/feast/onlinestore/bigtableonlinestore.go 93.91% 19 Missing and 8 partials ⚠️
go/internal/feast/onlinestore/onlinestore.go 50.00% 2 Missing and 1 partial ⚠️
❗ 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    #7193      +/-   ##
==========================================
+ Coverage   53.63%   54.17%   +0.53%     
==========================================
  Files         462      464       +2     
  Lines       58537    59094     +557     
  Branches     8632     8632              
==========================================
+ Hits        31397    32014     +617     
+ Misses      25005    24907      -98     
- Partials     2135     2173      +38     
Flag Coverage Δ *Carryforward flag
go-feature-server 41.15% <94.68%> (+10.18%) ⬆️
python-unit 55.21% <ø> (-0.01%) ⬇️ Carriedforward from 1d6cfb4

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
go/internal/feast/featurestore.go 44.76% <100.00%> (+36.34%) ⬆️
go/internal/feast/onlinestore/bigtableconfig.go 100.00% <100.00%> (ø)
go/internal/feast/onlinestore/redisonlinestore.go 49.50% <ø> (ø)
sdk/python/feast/infra/online_stores/bigtable.py 40.71% <ø> (-0.67%) ⬇️
go/internal/feast/onlinestore/onlinestore.go 75.78% <50.00%> (+19.12%) ⬆️
.../internal/feast/onlinestore/bigtableonlinestore.go 93.91% <93.91%> (ø)

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 1d6cfb4...b377218. 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.

@franciscojavierarceo franciscojavierarceo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need to make the new Python/Go parity fixture generation independent of the process-wide JSON patch. the current fixture test fails in three unit jobs, so the compatibility guard is not yet reliable.

"event_ts": cells[b"event_ts"].decode(),
"want_seconds": (aware - epoch) // timedelta(seconds=1),
"want_nanos": aware.microsecond * 1000,
"want_value": json_format.MessageToDict(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MessageToDict depends on Feast's process-wide proto_json.patch(), so these expected values change with test execution order. current-head CI generates want_value: -9007199254740993 instead of {'int64_val': '-9007199254740993'}, with the same mismatch on both macOS jobs. this makes the new parity test fail even though the cell bytes agree. we need to generate a stable typed protobuf JSON representation independently of that patch and cover generation both before and after it, while retaining the Go protojson.Unmarshal checks.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go feature server: support the Bigtable online store

4 participants