You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Enrico Olivelli <eo...@gmail.com> on 2017/12/05 16:43:38 UTC
CachingCalciteSchema thread safe ?
Hi,
I am getting strange NPEs using Calcite 1.15 (snapshot)
like this:
java.lang.NullPointerException
at
org.apache.calcite.prepare.PlannerImpl.rootSchema(PlannerImpl.java:312)
at
org.apache.calcite.prepare.PlannerImpl.createCatalogReader(PlannerImpl.java:291)
at
org.apache.calcite.prepare.PlannerImpl.validate(PlannerImpl.java:187)
at herddb.sql.CalcitePlanner.runPlanner(CalcitePlanner.java:346)
I am creating a rootSchema like this:
final SchemaPlus _rootSchema = Frameworks.createRootSchema(true);
then popuplate with subschematas:
for (String mySchema : mySchematas) {
SchemaPlus schema = _rootSchema.add(mySchema, new AbstractSchema());
....popuplate schema
}
then this rootSchema is considered immutable, no changes from the
application
There are concurrent calls to code like this:
SchemaPlus subSchema = schema.getSubSchema(defaultTableSpace);
final FrameworkConfig config = Frameworks.newConfigBuilder()
.....
.defaultSchema(subSchema)
.......
.build();
Planner planner = Frameworks.getPlanner(config);
SqlNode n = planner.parse(query);
n = planner.validate(n);
I am not able to reproduce the issue systematically, it happens on system
tests
But after the first error every other call fails with that NPE, so it
sounds like a broken cache o inconsistent status
Does any ring bell ?
Have you have seen concurrency issues in AbstractCached ?
I will be back with a reproducer as soon as possible.
I see that the 1.15 is still open so maybe I am able to demostrate a real
issue maybe we are in time for a last minute fix
Thanks
Enrico