-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[5.6] HHH-13613 : Improve CacheImplementor SPI to better support a DomainDa… #3029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.6
Are you sure you want to change the base?
Conversation
…taRegion and QueryResultsRegion with the same name
sessionFactory | ||
); | ||
regionsByName.put( queryResultsRegion.getName(), queryResultsRegion ); | ||
domainDataAndQueryResultsRegionNames.add( queryResultsRegion.getName() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default QueryResultsRegion
is not added to #legacySecondLevelCacheNames
. Should it be?
If so, should it be qualified?
legacySecondLevelCacheNames.add(
StringHelper.qualifyConditionally(
getSessionFactory().getSessionFactoryOptions().getCacheRegionPrefix(),
queryResultsRegion.getName()
)
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Practically speaking the default region does have a name, but conceptually that is not the case. No it should not be added to legacySecondLevelCacheNames
@Override | ||
public void evictQueryRegion(String regionName) { | ||
final QueryResultsCache cache = getQueryResultsCache( regionName ); | ||
final QueryResultsCache cache = namedQueryResultsCacheMap.get( regionName ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#getQueryResultsCache
will create a new QueryResultsCache
if one does not exist with the provided regionName
.
I didn't think that it made sense to create a new QueryResultsCache
when evicting, so I changed the line to lookup only an existing.
Should this be reverted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not creating the region on evict is better. So I'd leave your change
} | ||
final QueryResultsCacheImpl regionAccess = new QueryResultsCacheImpl( | ||
domainDataAndQueryResultsRegionNames.add( regionName ); | ||
legacySecondLevelCacheNames.add( regionName ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new named QueryResultsRegion
is not qualified when added to #legacySecondLevelCacheNames.
Should it be qualified as follows?
legacySecondLevelCacheNames.add( StringHelper.qualifyConditionally(
getSessionFactory().getSessionFactoryOptions().getCacheRegionPrefix(),
regionName )
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I believe that the legacy behavior was to not expect the user to prefix the names for query regions which is different than its expectations for domain data regions. Not completely sure, so we should maybe verify that.
Should a I suppose it makes sense to do this, if the application will ultimately create the region. WDYT? |
…taRegion and QueryResultsRegion with the same name
The stats reference itself should be created. So from there it depends whether you want to have a mutable |
Actually, WRT |
Thanks for your pull request! This pull request does not follow the contribution rules. Could you have a look? ❌ The pull request title should not end with an ellipsis (make sure the title is complete)
› This message was automatically generated. |
…taRegion and QueryResultsRegion with the same name
https://hibernate.atlassian.net/browse/HHH-13613
See the previous PR for earlier conversation: #3006