From 93b34a883eb595c52d3d2e87ea5e33b7e63fecac Mon Sep 17 00:00:00 2001 From: Yanbo Zhao Date: Wed, 6 May 2026 10:00:40 -0700 Subject: [PATCH] fix(ebean-dao): move SharedSchemaCache pre-warm to EbeanLocalAccess constructor ensureSchemaUpToDate() is LiX'd off in some services (e.g. MGA), so pre-warming was never firing in production. Moving registerAndPreWarm() into the constructor guarantees it runs at bean creation time regardless of whether ensureSchemaUpToDate() is called. Co-Authored-By: Claude Sonnet 4.6 --- .../java/com/linkedin/metadata/dao/EbeanLocalAccess.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java index 0bf033b73..e07e80710 100644 --- a/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java +++ b/dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/EbeanLocalAccess.java @@ -97,6 +97,10 @@ public EbeanLocalAccess(EbeanServer server, ServerConfig serverConfig, @Nonnull _schemaEvolutionManager = createSchemaEvolutionManager(serverConfig); _nonDollarVirtualColumnsEnabled = nonDollarVirtualColumnsEnabled; validator = buildValidator(server, serverConfig); + // Pre-warm at construction time so the cache is hot before the first request, + // regardless of whether ensureSchemaUpToDate() is called by the service. + validator.registerAndPreWarm(getTableName(_entityType)); + validator.registerAndPreWarm(getTestTableName(_entityType)); } private static SchemaValidatorUtil buildValidator(EbeanServer server, ServerConfig serverConfig) { @@ -135,9 +139,6 @@ public void configureOptionalForceIndex(@Nullable String indexName, public void ensureSchemaUpToDate() { _schemaEvolutionManager.ensureSchemaUpToDate(); - // Pre-warm the shared cache for both the prod and test tables so the first request is never slow. - validator.registerAndPreWarm(getTableName(_entityType)); - validator.registerAndPreWarm(getTestTableName(_entityType)); validateForceIndex(); }