Skip to content

Commit

Permalink
MONDRIAN-LAGUNITAS: Integrate from main @14916.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian-release/lagunitas/": change = 14920]
  • Loading branch information
julianhyde committed Feb 2, 2012
1 parent e4b8a79 commit 14843fe
Show file tree
Hide file tree
Showing 47 changed files with 1,547 additions and 534 deletions.
19 changes: 10 additions & 9 deletions build.properties
Expand Up @@ -3,7 +3,7 @@
# Agreement, available at the following URL:
# http://www.eclipse.org/legal/epl-v10.html.
# Copyright (C) 2002-2002 Kana Software, Inc.
# Copyright (C) 2002-2011 Julian Hyde and others.
# Copyright (C) 2002-2012 Julian Hyde and others.
# All Rights Reserved.
# You must accept the terms of that agreement to use this software.
#
Expand All @@ -12,20 +12,20 @@
Name=Mondrian
name=mondrian
vendor=Pentaho
project.revision=3.3-SNAPSHOT
project.revision.major=3
project.revision.minor=300014192
project.revision=4.0-SNAPSHOT
project.revision.major=4
project.revision.minor=0
ivy.artifact.id=mondrian
ivy.artifact.group=pentaho
impl.title=mondrian
driver.name=Mondrian olap4j driver
driver.version=3.3.0.14192
driver.version.major=3
driver.version.minor=300014192
driver.version=4.0.0.14919
driver.version.major=4
driver.version.minor=0

#dependency for olap4j
dependency.olap4j-core.revision=1.0.0-SNAPSHOT
dependency.olap4j.revision=1.0.0-SNAPSHOT
dependency.olap4j-core.revision=1.0.1.494
dependency.olap4j.revision=1.0.1.494

#dependency properties: used during resolve step of workbench build
dependency.kettle.revision=TRUNK-SNAPSHOT
Expand All @@ -40,3 +40,4 @@ dependency.pentaho-launcher.revision=1.0.0
# mondrian.tests.skip=true

# End build.properties

8 changes: 8 additions & 0 deletions build.xml
Expand Up @@ -1449,6 +1449,14 @@ diagrams and hyperlinks to source code">
<linecontains negate="true">
<contains value="Tag @link: can't find unwrap(Class)"/>
</linecontains>
<!-- ignore: Statement.closeOnCompletion does not exist until JDK1.7 -->
<linecontains negate="true">
<contains value="Tag @link: can't find closeOnCompletion()"/>
</linecontains>
<!-- ignore: ResultSet.isClosed does not exist until JDK1.6 -->
<linecontains negate="true">
<contains value="Tag @link: can't find isClosed()"/>
</linecontains>
<!-- ignore: FactoryJdbc4Impl is only built in JDK1.6 -->
<linecontains negate="true">
<contains value="FactoryJdbc4Impl.java"/>
Expand Down
10 changes: 5 additions & 5 deletions src/main/mondrian/olap4j/FactoryJdbc41Impl.java
Expand Up @@ -3,7 +3,7 @@
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 2007-2011 Julian Hyde
// Copyright (C) 2007-2012 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
Expand Down Expand Up @@ -170,11 +170,11 @@ public MondrianOlap4jStatementJdbc41(
}

public void closeOnCompletion() throws SQLException {
throw new UnsupportedOperationException();
closeOnCompletion = true;
}

public boolean isCloseOnCompletion() throws SQLException {
throw new UnsupportedOperationException();
return closeOnCompletion;
}
}

Expand All @@ -190,11 +190,11 @@ public MondrianOlap4jPreparedStatementJdbc41(
}

public void closeOnCompletion() throws SQLException {
throw new UnsupportedOperationException();
closeOnCompletion = true;
}

public boolean isCloseOnCompletion() throws SQLException {
throw new UnsupportedOperationException();
return closeOnCompletion;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/mondrian/olap4j/MondrianOlap4jCellSet.java
Expand Up @@ -3,7 +3,7 @@
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 2007-2011 Julian Hyde
// Copyright (C) 2007-2012 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
Expand Down Expand Up @@ -272,6 +272,7 @@ public void close() {
if (this.result != null) {
this.result.close();
}
olap4jStatement.onResultSetClose(this);
}

public boolean wasNull() throws SQLException {
Expand Down
17 changes: 17 additions & 0 deletions src/main/mondrian/olap4j/MondrianOlap4jStatement.java
Expand Up @@ -39,6 +39,11 @@ abstract class MondrianOlap4jStatement
final MondrianOlap4jConnection olap4jConnection;
private boolean closed;

/**
* Support for {@link #closeOnCompletion()} method.
*/
protected boolean closeOnCompletion;

/**
* Current cell set, or null if the statement is not executing anything.
* Any method which modifies this member must synchronize
Expand Down Expand Up @@ -460,6 +465,18 @@ public RolapConnection getMondrianConnection() {
throw new RuntimeException(e);
}
}

/**
* Called by each child result set (most likely a cell set) when it is
* closed.
*
* @param resultSet Result set or cell set
*/
void onResultSetClose(ResultSet resultSet) {
if (closeOnCompletion) {
close();
}
}
}

// End MondrianOlap4jStatement.java
20 changes: 20 additions & 0 deletions src/main/mondrian/resource/MondrianResource.xml
Expand Up @@ -857,6 +857,26 @@
</text>
</exception>

<!-- ====================================================================== -->
<!-- GC -->
<exception id="9000001" name="FinalizerErrorRolapSchema">
<text>
An exception was encountered while finalizing a RolapSchema object instance.
</text>
</exception>

<exception id="9000002" name="FinalizerErrorMondrianServerImpl">
<text>
An exception was encountered while finalizing a RolapSchema object instance.
</text>
</exception>

<exception id="9000003" name="FinalizerErrorRolapConnection">
<text>
An exception was encountered while finalizing a RolapConnection object instance.
</text>
</exception>

<!-- End of last error section ============================================ -->

</resourceBundle>
Expand Down
42 changes: 8 additions & 34 deletions src/main/mondrian/rolap/CacheControlImpl.java
Expand Up @@ -10,6 +10,7 @@
package mondrian.rolap;

import mondrian.olap.*;
import mondrian.olap.CacheControl.CellRegion;
import mondrian.olap.Id.Quoting;
import mondrian.resource.MondrianResource;
import mondrian.rolap.agg.SegmentCacheManager;
Expand Down Expand Up @@ -440,7 +441,7 @@ public void visit(MemberRangeCellRegion region) {
return list;
}

static Collection<RolapStar> getStars(CellRegion region) {
public static Collection<RolapStar> getStars(CellRegion region) {
return findStars(region).left;
}

Expand Down Expand Up @@ -533,7 +534,7 @@ public void visit(MemberRangeCellRegion region) {

public void printCacheState(
final PrintWriter pw,
CellRegion region)
final CellRegion region)
{
for (RolapStar star : getStars(region)) {
star.print(pw, "", false);
Expand All @@ -542,12 +543,12 @@ public void printCacheState(
MondrianServer.forConnection(connection)
.getAggregationManager().cacheMgr;
Locus.execute(
Execution.NONE,
connection,
"CacheControlImpl.printCacheState",
new Locus.Action<Object>() {
public Object execute() {
return manager.execute(
new PrintCacheStateCommand(manager, pw, Locus.peek()));
new Locus.Action<Void>() {
public Void execute() {
manager.printCacheState(region, pw, Locus.peek());
return null;
}
});
}
Expand Down Expand Up @@ -1543,33 +1544,6 @@ public void commit() {
}
}

private static class PrintCacheStateCommand
implements SegmentCacheManager.Command<Void>
{
private final SegmentCacheManager manager;
private final PrintWriter pw;
private final Locus locus;

public PrintCacheStateCommand(
SegmentCacheManager manager,
PrintWriter pw,
Locus locus)
{
this.manager = manager;
this.pw = pw;
this.locus = locus;
}

public Void call() {
manager.segmentIndex.printCacheState(pw);
return null;
}

public Locus getLocus() {
return locus;
}
}

/**
* Command that deletes a member and its descendants from the cache.
*/
Expand Down
15 changes: 9 additions & 6 deletions src/main/mondrian/rolap/FastBatchingCellReader.java
Expand Up @@ -13,6 +13,7 @@
import mondrian.rolap.agg.*;
import mondrian.rolap.aggmatcher.AggGen;
import mondrian.rolap.aggmatcher.AggStar;
import mondrian.rolap.cache.SegmentCacheIndex;
import mondrian.rolap.cache.SegmentCacheIndexImpl;
import mondrian.server.Execution;
import mondrian.server.Locus;
Expand Down Expand Up @@ -247,7 +248,7 @@ boolean loadAggregations() {
for (SegmentHeader header : response.cacheSegments) {
final SegmentBody body = cacheMgr.compositeCache.get(header);
if (body == null) {
cacheMgr.remove(header);
cacheMgr.remove(cube.getStar(), header);
failedSegments.add(header);
++failureCount;
continue;
Expand Down Expand Up @@ -442,7 +443,7 @@ private SegmentBody loadSegmentFromCache(
}
body = cacheMgr.compositeCache.get(header);
if (body == null) {
cacheMgr.remove(header);
cacheMgr.remove(cube.getStar(), header);
return null;
}
headerBodies.put(header, body);
Expand Down Expand Up @@ -541,8 +542,10 @@ private void recordCellRequest2(final CellRequest request) {
final RolapStar.Measure measure = request.getMeasure();
final RolapStar star = measure.getStar();
final RolapSchema schema = star.getSchema();
final SegmentCacheIndex index =
cacheMgr.getIndexRegistry().getIndex(star);
final List<SegmentHeader> headersInCache =
cacheMgr.segmentIndex.locate(
index.locate(
schema.getName(),
schema.getChecksum(),
measure.getCubeName(),
Expand All @@ -560,7 +563,7 @@ private void recordCellRequest2(final CellRequest request) {
if (!headersInCache.isEmpty()) {
final SegmentHeader headerInCache = headersInCache.get(0);
final Future<SegmentBody> future =
cacheMgr.segmentIndex.getFuture(headerInCache);
index.getFuture(headerInCache);
if (future != null) {
// Segment header is in cache, body is being loaded. Worker will
// need to wait for load to complete.
Expand All @@ -569,7 +572,7 @@ private void recordCellRequest2(final CellRequest request) {
// Segment is in cache.
cacheHeaders.add(headerInCache);
}
cacheMgr.segmentIndex.setConverter(
index.setConverter(
headerInCache.schemaName,
headerInCache.schemaChecksum,
headerInCache.cubeName,
Expand Down Expand Up @@ -597,7 +600,7 @@ private void recordCellRequest2(final CellRequest request) {
// Don't even bother doing a segment lookup if we can't
// rollup that measure.
final List<List<SegmentHeader>> rollup =
cacheMgr.segmentIndex.findRollupCandidates(
index.findRollupCandidates(
schema.getName(),
schema.getChecksum(),
measure.getCubeName(),
Expand Down
11 changes: 9 additions & 2 deletions src/main/mondrian/rolap/RolapConnection.java
Expand Up @@ -281,8 +281,15 @@ public RolapConnection(

@Override
protected void finalize() throws Throwable {
super.finalize();
close();
try {
super.finalize();
close();
} catch (Throwable t) {
LOGGER.info(
MondrianResource.instance()
.FinalizerErrorRolapConnection.baseMessage,
t);
}
}

/**
Expand Down

0 comments on commit 14843fe

Please sign in to comment.