Skip to content
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

CacheControl.flushSchema apparently not working #1273

Open
andreasOL16 opened this issue Jul 16, 2021 · 1 comment
Open

CacheControl.flushSchema apparently not working #1273

andreasOL16 opened this issue Jul 16, 2021 · 1 comment

Comments

@andreasOL16
Copy link

andreasOL16 commented Jul 16, 2021

Hi, I use Mondrian (master branch) as jar with xmondrian servlet https://github.com/markkimsal/mondrian.war and it principally works great. There are multiple datasources/schemas. But I cannot flush data belonging to one schema only. I use a simple jsp for this with the essential code being

Iterator<RolapSchema> schemaIterator = RolapSchema.getRolapSchemas().iterator();
while (schemaIterator.hasNext()) {`
        RolapSchema schema = schemaIterator.next();
        if (!schema.getName().equals(clear)) {
                out.print("Schema " + schema.getName() + " skipped");
        }
        else {
                out.print("Schema " + schema.getName() + " flushing...");
                CacheControl cacheControl = schema.getInternalConnection().getCacheControl(null);
                for (Cube cube: schema.getCubes()) {
                        CacheControl.CellRegion measuresRegion = cacheControl.createMeasuresRegion(cube);
                        cacheControl.flush(measuresRegion);
                        out.print("Cube " + cube.getName() + " flushed");
                }
                cacheControl.flushSchema(schema);
        }
}

clear contains the name of the schema to be deleted. It is found and in addition to flushSchema I also clear the measures regions of each cube in the schema but I'm not sure if that's important if I do flushSchema anyway.

So, problem is that after a change in the underlying database and executing this script I still get old values if I do an MDX query that has been done before the flushing.

With a web search I only have found examples that boil down to the above code so this seems to be the common way of doing it.

At the moment I do a servlet restart by touching web.xml and that works but if there are multipe schemas with multiple data warehouses this leads to unwanted performance delays for queries on unaffected dwhs.

Thanks,
Andreas

@suxiaoyan521
Copy link

RolapConnection.getCacheControl(null).flushSchemaCache();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants