Skip to content

fix(ebean-dao): re-warm schema cache at end of ensureSchemaUpToDate (#618 regression)#627

Merged
NatalliaUlashchick merged 1 commit into
masterfrom
naulashc/prewarm-after-schema-evolution
Jun 16, 2026
Merged

fix(ebean-dao): re-warm schema cache at end of ensureSchemaUpToDate (#618 regression)#627
NatalliaUlashchick merged 1 commit into
masterfrom
naulashc/prewarm-after-schema-evolution

Conversation

@NatalliaUlashchick

@NatalliaUlashchick NatalliaUlashchick commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

#615 pre-warmed SharedSchemaCache at the end of EbeanLocalAccess.ensureSchemaUpToDate(). #618 moved that pre-warm into the constructor (so it also runs for deploys that gate ensureSchemaUpToDate() off and migrate schema as a separate job) — but it removed the post-evolution re-warm.

For consumers that build their schema in-JVM at boot (i.e. that call ensureSchemaUpToDate() — e.g. integration tests / dev deploys with skipSchemaUpdate=false), the constructor pre-warm now runs before the schema-evolution DDL. It caches an empty/incomplete view that is pinned for the cache TTL, so columnExists()/indexExists() report missing columns/indexes, EbeanLocalAccess.batchGetUnion drops the aspect from its query, and reads silently return nothing.

Fix: restore the pre-warm at the end of ensureSchemaUpToDate() (after the evolution DDL is applied), while keeping #618's constructor pre-warm. The re-warm overwrites the stale entry with the complete, post-migration schema. It runs only where ensureSchemaUpToDate() is called (in-JVM schema build, skipSchemaUpdate=false); deploys that gate it off (prod) are unaffected — there the constructor pre-warm already sees the complete schema. Effectively recovers #615/0.6.183 behavior for that path without giving up #618's prod cold-start win.

Testing Done

  • Added EbeanLocalAccessTest.testEnsureSchemaUpToDateReWarmsSharedSchemaCache: constructs an access (constructor pre-warm), adds a column after construction, then asserts ensureSchemaUpToDate() re-warms the shared cache. Fails on the pre-fix behavior (verified — 2 failures across both nonDollarVirtualColumnsEnabled factory variants); passes with the fix.
  • All ensureSchemaUpToDate-exercising test classes pass: EbeanLocalAccessTest, InstrumentedEbeanLocalAccessTest, FlywaySchemaEvolutionManagerTest, FlywaySchemaEvolutionManagerTestWithoutServiceIdentifier.
  • AIM to verify end-to-end on ai-metadata-gms against a build with this change.

Checklist

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.91%. Comparing base (e528785) to head (84de99a).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #627      +/-   ##
============================================
+ Coverage     66.86%   66.91%   +0.05%     
- Complexity     1886     1887       +1     
============================================
  Files           148      148              
  Lines          7274     7276       +2     
  Branches        881      881              
============================================
+ Hits           4864     4869       +5     
+ Misses         2025     2022       -3     
  Partials        385      385              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…618 regression)

#615 pre-warmed SharedSchemaCache at the end of EbeanLocalAccess.ensureSchemaUpToDate().
#618 moved that pre-warm into the constructor (so it also runs for deploys that gate
ensureSchemaUpToDate() off and migrate schema as a separate job) -- but it removed the
post-evolution re-warm. For consumers that build their schema in-JVM at boot (i.e. that
call ensureSchemaUpToDate(), e.g. integration tests / dev with skipSchemaUpdate=false), the
constructor pre-warm now runs BEFORE the schema-evolution DDL, caching an empty/incomplete
view that is pinned for the cache TTL. columnExists()/indexExists() then report missing
columns/indexes, EbeanLocalAccess.batchGetUnion drops the aspect from its query, and reads
silently return nothing -- surfacing in AIM ai-metadata-gms as 404s on aspect reads, wrong
autofill defaults, dropped writes, and wrong snapshot/member counts.

Restore the pre-warm at the end of ensureSchemaUpToDate() (after the evolution DDL is
applied) while keeping #618's constructor pre-warm. The re-warm overwrites the stale entry
with the complete, post-migration schema. It runs only where ensureSchemaUpToDate() is
called (in-JVM schema build); deploys that gate it off (prod) are unaffected -- there the
constructor pre-warm already sees a complete schema. Effectively recovers #615's behavior
for that path without giving up #618.

Adds an EbeanLocalAccessTest regression test that evolves the schema after construction and
asserts ensureSchemaUpToDate() re-warms the shared cache (fails on the pre-fix behavior).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@NatalliaUlashchick NatalliaUlashchick force-pushed the naulashc/prewarm-after-schema-evolution branch from 20a2076 to 84de99a Compare June 15, 2026 17:39
@NatalliaUlashchick NatalliaUlashchick merged commit ac1c157 into master Jun 16, 2026
2 checks passed
mridul111998 pushed a commit to mridul111998/datahub-gma that referenced this pull request Jul 3, 2026
…inkedin#618 regression) (linkedin#627)

linkedin#615 pre-warmed SharedSchemaCache at the end of EbeanLocalAccess.ensureSchemaUpToDate().
linkedin#618 moved that pre-warm into the constructor (so it also runs for deploys that gate
ensureSchemaUpToDate() off and migrate schema as a separate job) -- but it removed the
post-evolution re-warm. For consumers that build their schema in-JVM at boot (i.e. that
call ensureSchemaUpToDate(), e.g. integration tests / dev with skipSchemaUpdate=false), the
constructor pre-warm now runs BEFORE the schema-evolution DDL, caching an empty/incomplete
view that is pinned for the cache TTL. columnExists()/indexExists() then report missing
columns/indexes, EbeanLocalAccess.batchGetUnion drops the aspect from its query, and reads
silently return nothing -- surfacing in AIM ai-metadata-gms as 404s on aspect reads, wrong
autofill defaults, dropped writes, and wrong snapshot/member counts.

Restore the pre-warm at the end of ensureSchemaUpToDate() (after the evolution DDL is
applied) while keeping linkedin#618's constructor pre-warm. The re-warm overwrites the stale entry
with the complete, post-migration schema. It runs only where ensureSchemaUpToDate() is
called (in-JVM schema build); deploys that gate it off (prod) are unaffected -- there the
constructor pre-warm already sees a complete schema. Effectively recovers linkedin#615's behavior
for that path without giving up linkedin#618.

Adds an EbeanLocalAccessTest regression test that evolves the schema after construction and
asserts ensureSchemaUpToDate() re-warms the shared cache (fails on the pre-fix behavior).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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