flyrain commented on code in PR #4054:
URL: https://github.com/apache/polaris/pull/4054#discussion_r3023547423
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java:
##########
@@ -67,19 +69,31 @@ public class JdbcMetaStoreManagerFactory implements
MetaStoreManagerFactory {
private static final Logger LOGGER =
LoggerFactory.getLogger(JdbcMetaStoreManagerFactory.class);
- final Map<String, PolarisMetaStoreManager> metaStoreManagerMap = new
HashMap<>();
- final Map<String, EntityCache> entityCacheMap = new HashMap<>();
- final Map<String, Supplier<BasePersistence>> sessionSupplierMap = new
HashMap<>();
+ // Stateful per-realm cache — InMemoryEntityCache accumulates entries across
requests
+ final Map<String, EntityCache> entityCacheMap = new ConcurrentHashMap<>();
+
+ // Cached per-realm schema version — loaded from DB once, stable at runtime
+ private final ConcurrentHashMap<String, Integer> schemaVersionCache = new
ConcurrentHashMap<>();
+
+ // Tracks realms that have already passed the bootstrap verification check
+ // (checkPolarisServiceBootstrappedForRealm), avoiding redundant DB hits on
subsequent calls.
+ private final Set<String> verifiedRealms = ConcurrentHashMap.newKeySet();
@Inject Clock clock;
@Inject PolarisDiagnostics diagnostics;
@Inject PolarisStorageIntegrationProvider storageIntegrationProvider;
- @Inject Instance<DataSource> dataSource;
- @Inject RelationalJdbcConfiguration relationalJdbcConfiguration;
+ @Inject DatasourceOperations datasourceOperations;
@Inject RealmConfig realmConfig;
protected JdbcMetaStoreManagerFactory() {}
+ @Produces
+ @ApplicationScoped
+ DatasourceOperations produceDatasourceOperations(
Review Comment:
Do we plan to let other classes use this application scoped bean? Somewhere
like
https://github.com/apache/polaris/blob/8cbfb268c780c976acd59536c60d4ae06089c46f/persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/idempotency/RelationalJdbcIdempotencyStore.java#L47.
Not a blocker though, we could do that as a followup.
Also in that case, should we move this bean producer out of this class, as
it could be injected by multiple classes. Not a blocker as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]