Skip to content

Commit

Permalink
MONDRIAN: Add 'UseSchemaPool' connect-string parameter, and deprecate…
Browse files Browse the repository at this point in the history
… the 'fresh' parameter to DriverManager.getConnection() methods.

[git-p4: depot-paths = "//open/mondrian/": change = 9098]
  • Loading branch information
julianhyde committed Apr 12, 2007
1 parent 19513dc commit b36c970
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 54 deletions.
40 changes: 26 additions & 14 deletions doc/configuration.html
Expand Up @@ -38,7 +38,6 @@ <h3>Contents</h3>
<li><a href="#Cache_management">Cache_management</a><ol>
<li><a href="#Schema_cache">Schema_cache</a></li>
</ol>
</ol>
<li><a href="#Memory_management">Memory_management</a><ol>
<li><a href="#Out_of_memory">Out of memory</a></li>
</ol>
Expand Down Expand Up @@ -79,7 +78,7 @@ <h3>1.1 Property list<a name="Property_list">&nbsp;</a></h3>
example, those in the 'Testing' are only applicable if are running Mondrian's
suite of regression tests.</p>

<table class="grayTable" width="500">
<table class="grayTable">
<tr>
<td><strong>Property</strong></td>
<td><strong>Type</strong></td>
Expand Down Expand Up @@ -896,16 +895,19 @@ <h3>Connect string syntax<a name="Connect_string_syntax">&nbsp;</a></h3>

<p>Mondrian connect strings are a connection of property/value pairs, of the
form 'property=value;property=value;...'.</p>

<p>Values can be enclosed in single-quotes, which allows them to contain spaces
and punctuation. See the the
<a target="_blank" href="http://msdn.microsoft.com/library/en-us/oledb/htm/oledbconnectionstringsyntax.asp">
OLE DB connect string syntax specification</a>.</p>

<p>The supported properties are described below.</p>

<h3>Connect string properties<a name="Connect_string_properties">&nbsp;</a></h3>

<table border="1" id="table1">
<table class="grayTable" width="500">
<tr>
<th>Namee</th>
<th>Name</th>
<th>Required?</th>
<th>Description</th>
</tr>
Expand Down Expand Up @@ -1024,14 +1026,24 @@ <h3>Connect string properties<a name="Connect_string_properties">&nbsp;</a></h3>
<tr>
<td>UseContentChecksum</td>
<td>No</td>
<td><p>Allows to work with dynamically changing schema. If this property
<td><p>Allows mondrian to work with dynamically changing schema. If this property
is set to <code>true</code> and schema content has changed (previous
checksum doesn't equal with current), schema would be reloaded.
Default is <code>false</code>.</p>

The default is <code>false</code>.</p>
<p>Could be
used in combination with <code>DynamicSchemaProcessor</code> property.</p></td>
</tr>
<tr>
<td>UseSchemaPool</td>
<td>No</td>
<td><p>Controls whether a new connection use a schema from the schema
cache. If <code>true</code>, the default, a connection shares a schema
definition (and hence also a cache of aggregate data retrieved by
previous queries) with other connections which have a textually
identical schema definition.</p>
<p>If <code>false</code>, the connection has a private schema definition
and cache.</p></td>
</tr>
<tr>
<td>DynamicSchemaProcessor</td>
<td>No</td>
Expand Down Expand Up @@ -1095,7 +1107,7 @@ <h3>Out Of Memory<a name="Out_of_memory"></a></h3>

<p>Java <code>OutOfMemoryError</code>s have always been an issue with
applications. When the JVM throws an <code>Error</code> as
oppose to an <code>Exception</code> it is telling the application
opposed to an <code>Exception</code> it is telling the application
that its world has ended and it has no recourse but to die.
Prior to Java5 there was not much one could do other
than buy 64-bit machines with lots of RAM and hope for the best.
Expand Down Expand Up @@ -1140,22 +1152,22 @@ <h3>Out Of Memory<a name="Out_of_memory"></a></h3>
and some other code later on registers a level of
90%, then it is the 90% that the JVM knows about - it knows nothing
of the previously registered 80%. What this means is that the code
expecting to be notified when the memory level crosses 80%, wont be
notified!!! For many applications that don't share their JVM with
other applications, this is not a problem. For Mondrian is it
expecting to be notified when the memory level crosses 80%, won't be notified!<p>
For many applications that don't share their JVM with
other applications, this is not a problem, but for Mondrian is it
potentially an issue. Mondrian can be running in a Webserver and
Webservers can have more than one independent applications.
Each such application can register a different memory threshold
notification level.
In general, application containing applications such as
Webservers or Appservers are a problem with the current
In general, application-containing applications such as
web-servers or application-servers are a problem with the current
Java5 memory threshold notification approach.
At the current time, I do not know a way around this problem.


<hr noshade size="1"/>
<p>
Author: Julian Hyde; last modified August 2006.<br/>
Author: Julian Hyde; last modified April 2007.<br/>
Version: $Id$
(<a href="http://p4web.eigenbase.org/open/mondrian/doc/configuration.html?ac=22">log</a>)<br/>
Copyright (C) 2006-2007 Julian Hyde
Expand Down
127 changes: 97 additions & 30 deletions src/main/mondrian/olap/DriverManager.java
Expand Up @@ -32,82 +32,150 @@ public DriverManager() {
}

/**
* Creates a connection to a Mondrian OLAP Server.
* Creates a connection to a Mondrian OLAP Engine
* using a connect string
* and a catalog locator.
*
* @param connectString Connect string of the form
* 'property=value;property=value;...'.
* See {@link Util#parseConnectString} for more details of the format.
* See {@link mondrian.olap.Util#parseConnectString} for more details of the format.
* See {@link mondrian.rolap.RolapConnectionProperties} for a list of
* allowed properties.
* @param locator Use to locate real catalog url by a customized
* configuration value. If <code>null</code>, leave the catalog url
* unchanged.
* @param fresh If <code>true</code>, a new connection is created;
* if <code>false</code>, the connection may come from a connection pool.
* @return A {@link Connection}
* @post return != null
*/
public static Connection getConnection(
String connectString,
CatalogLocator locator,
boolean fresh) {
String connectString,
CatalogLocator locator)
{
Util.PropertyList properties = Util.parseConnectString(connectString);
return getConnection(properties, locator, fresh);
return getConnection(properties, locator);
}

/**
* Creates a connection to a Mondrian OLAP Server.
* Creates a connection to a Mondrian OLAP Engine
* using a connect string,
* a catalog locator,
* and the deprecated <code>fresh</code> parameter.
*
* @deprecated Use {@link #getConnection(mondrian.olap.Util.PropertyList, mondrian.spi.CatalogLocator, boolean)}
* @deprecated The <code>fresh</code> parameter is no longer used;
* use the {@link #getConnection(String, mondrian.spi.CatalogLocator)}
* method, and if you want a connection with a non-shared schema, specify
* "{@link mondrian.rolap.RolapConnectionProperties#UseSchemaPool UseSchemaPool}=false"
* among your connection properties.
*/
public static Connection getConnection(
Util.PropertyList properties,
boolean fresh) {
return getConnection(properties, CatalogLocatorImpl.INSTANCE, fresh);
String connectString,
CatalogLocator locator,
boolean fresh)
{
Util.discard(fresh); // no longer used
return getConnection(connectString, locator);
}

/**
* Creates a connection to a Mondrian OLAP Server.
* Creates a connection to a Mondrian OLAP Engine
* using a list of connection properties
* and the deprecated <code>fresh</code> parameter.
*
* @deprecated Use {@link #getConnection(mondrian.olap.Util.PropertyList, mondrian.spi.CatalogLocator)}
*/
public static Connection getConnection(
Util.PropertyList properties,
boolean fresh)
{
Util.discard(fresh); // no longer used
return getConnection(properties, CatalogLocatorImpl.INSTANCE);
}

/**
* Creates a connection to a Mondrian OLAP Engine
* using a list of connection properties,
* a catalog locator,
* and the deprecated <code>fresh</code> parameter.
*
* @deprecated The <code>fresh</code> parameter is no longer used;
* use the {@link #getConnection(mondrian.olap.Util.PropertyList, mondrian.spi.CatalogLocator)}
* method, and if you want a connection with a non-shared schema, specify
* "{@link mondrian.rolap.RolapConnectionProperties#UseSchemaPool UseSchemaPool}=false"
* among your connection properties.
*/
public static Connection getConnection(
Util.PropertyList properties,
CatalogLocator locator,
boolean fresh)
{
Util.discard(fresh); // no longer used
return getConnection(properties, locator);
}

/**
* Creates a connection to a Mondrian OLAP Engine.
*
* @param properties Collection of properties which define the location
* of the connection.
* See {@link RolapConnection} for a list of allowed properties.
* See {@link mondrian.rolap.RolapConnection} for a list of allowed properties.
* @param locator Use to locate real catalog url by a customized
* configuration value. If <code>null</code>, leave the catalog url
* unchanged.
* @param fresh If <code>true</code>, a new connection is created;
* if <code>false</code>, the connection may come from a connection pool.
* @return A {@link Connection}
* @post return != null
*/
public static Connection getConnection(
Util.PropertyList properties,
CatalogLocator locator,
boolean fresh) {
return getConnection(properties, locator, null, fresh);
Util.PropertyList properties,
CatalogLocator locator)
{
return getConnection(properties, locator, null);
}

/**
* Creates a connection to a Mondrian OLAP Server.
* Creates a connection to a Mondrian OLAP Engine
* using a list of connection properties,
* a catalog locator,
* a JDBC data source,
* and the deprecated <code>fresh</code> parameter.
*
* @deprecated The <code>fresh</code> parameter is no longer used;
* use the {@link #getConnection(mondrian.olap.Util.PropertyList, mondrian.spi.CatalogLocator, javax.sql.DataSource)}
* method, and if you want a connection with a non-shared schema, specify
* "{@link mondrian.rolap.RolapConnectionProperties#UseSchemaPool UseSchemaPool}=false"
* among your connection properties.
*/
public static Connection getConnection(
Util.PropertyList properties,
CatalogLocator locator,
DataSource dataSource,
boolean fresh)
{
Util.discard(fresh); // no longer used
return getConnection(properties, locator, dataSource);
}

/**
* Creates a connection to a Mondrian OLAP Engine
* using a list of connection properties,
* a catalog locator,
* and a JDBC data source.
*
* @param properties Collection of properties which define the location
* of the connection.
* See {@link RolapConnection} for a list of allowed properties.
* See {@link mondrian.rolap.RolapConnection} for a list of allowed properties.
* @param locator Use to locate real catalog url by a customized
* configuration value. If <code>null</code>, leave the catalog url
* unchanged.
* @param dataSource - if not null an external DataSource to be used
* by Mondrian
* @param fresh If <code>true</code>, a new connection is created;
* if <code>false</code>, the connection may come from a connection pool.
* @return A {@link Connection}
* @post return != null
*/
public static Connection getConnection(
Util.PropertyList properties,
CatalogLocator locator,
DataSource dataSource,
boolean fresh) {
Util.PropertyList properties,
CatalogLocator locator,
DataSource dataSource)
{
String provider = properties.get("PROVIDER", "mondrian");
if (!provider.equalsIgnoreCase("mondrian")) {
throw Util.newError("Provider not recognized: " + provider);
Expand All @@ -123,5 +191,4 @@ public static Connection getConnection(
}
}


// End DriverManager.java
18 changes: 17 additions & 1 deletion src/main/mondrian/rolap/RolapConnectionProperties.java
Expand Up @@ -14,6 +14,14 @@
/**
* <code>RolapConnectionProperties</code> enumerates the allowable values of
* keywords in a Mondrian connect string.
*
* <p><b>Note to developers</b>: If you add or modify a connection-string
* property, you must also modify the
* <a target="_top" href="{@docRoot}/../configuration.html#Connect_string_properties">
* Configuration Specification</a>.
*
* @version $Id$
* @author jhyde
*/
public enum RolapConnectionProperties {
/**
Expand Down Expand Up @@ -107,6 +115,13 @@ public enum RolapConnectionProperties {
*/
UseContentChecksum,

/**
* The "UseSchemaPool" property disables the schema cache. If false, the
* schema is not shared with connections which have a textually identical
* schema. Default is "true".
*/
UseSchemaPool,

/**
* The name of a class implementing the
* {@link mondrian.spi.DynamicSchemaProcessor} interface.
Expand All @@ -130,13 +145,14 @@ public enum RolapConnectionProperties {
* mondrian every time the datasource is changed.
*/
DataSourceChangeListener;

/**
* Any property beginning with this value will be added to the
* JDBC connection properties, after removing this prefix. This
* allows you to specify connection properties without a URL.
*/
public static final String JdbcPropertyPrefix = "jdbc.";

}
}

// End RolapConnectionProperties.java

0 comments on commit b36c970

Please sign in to comment.