borinquenkid commented on PR #15771:
URL: https://github.com/apache/grails-core/pull/15771#issuecomment-4818671829

   > @borinquenkid as I have dug into this O(M×N) only occurs with DATABASE 
(database-per-tenant), which is why I had never seen it in my apps.
   > 
   > Mode       O(M×N) at startup?
   > DISCRIMINATOR (column)     No (single shared connection)
   > SCHEMA (schema-per-tenant) No (tenants added dynamically at runtime)
   > DATABASE (database-per-tenant)     Yes (static per-tenant datasources)
   
   @jamesfredley 
    Good catch — one addition to the SCHEMA row: allQualifiers() calls 
schemaHandler.resolveSchemaNames() against the live database at startup, so if 
N schemas already exist (the typical production case), the original code did 
create N×M APIs eagerly there too. The apiQualifiers optimisation in this PR 
collapses that to M for SCHEMA mode as well
   
   We've also landed a fix for the CI failures the optimisation introduced: 
stale lazy-cached APIs were left in STATIC_APIS after addTenantForSchema 
re-created a child datastore, causing "No Session found" on the second test. 
GormEnhancer.registerEntity now evicts those entries for non-eager qualifiers 
so they're rebuilt against the current session factory on next access.


-- 
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]

Reply via email to