Getting the CacheRegionStatistics before executing a query leads to a NPE later on

Description

Consider the following test case:

When executing it, we get this issue:

This is what causes the problem.

When calling the getQueryRegionStatistics, this is what is being fetched:

l2CacheStatsMap.getOrCompute( regionName, this::computeQueryRegionStatistics );

And, the computeQueryRegionStatistics will be called and will cache a value of null because the region is not available yet:

final QueryResultsCache regionAccess = cache.getQueryResultsCacheStrictly( regionName );

Returns null at this point.

That region is built upon executing the query later on.

What I saw that worked was something like this:

Executing this before calling getQueryRegionStatistics("default-query-results-region") fixed the problem.

Attachments

1

Activity

Show:
Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created March 3, 2022 at 6:33 PM
Updated March 15, 2022 at 11:28 AM
Resolved March 9, 2022 at 11:10 AM