PDA

View Full Version : Re : [Mondrian]



michael bienstein
01-23-2007, 09:00 AM
Can you guys who can reproduce this bug modify the test to use a formatter for the null value? I would really like to know if it is a Java null, a nullValue() or what that is being formatted in the calculated measure's column there. This can be debugged without a debugger. If it is a null value of some sort we can trace back to where it came from in the code. I can't reproduce myself.


----- Message d'origine ----
De : Pappyn Bart <Bart.Pappyn (AT) vandewiele (DOT) com>

Pappyn Bart
01-23-2007, 09:10 AM
Connections and transactions should live as long as the cache, not a single mdx query.

I am about to check in other changes to the rolapstar like I described before in this thread,
please note that transactions and connection change will not be there yet. The changes
I will check in have most of to do with multi-user access and the plugin.

When a query is executed, first changes are checked by using the data source change listener plugin.

When changes are detected, than the transaction for - this thread only - should be stopped and a new
one should be taken. Other concurrently running threads should use the old connection/transactions.

When new queries are executed after changes have check in, a new connection/transaction should be started.

That way, a single mdx query should always look at the same data - what should be the whole point.

The changes I have made now apply to the data source change listener plugin, but a similar approach could
be taken for explicit cache flushing.

Bart

________________________________

From: mondrian-bounces (AT) pentaho (DOT) org [mailto:mondrian-bounces (AT) pentaho (DOT) org] On Behalf Of michael bienstein
Sent: dinsdag 23 januari 2007 13:52
To: Mondrian developer mailing list
Subject: Re : [Mondrian] Re:VirtualCubeTest.testCalculatedMemberAcrossCubesfailing on SMP


Just two thoughts on this:
1) Currently I think that a HashMap is used for the global cache. HashMap is not safely synchronized. There is a synchronize block that is too large probably - the whole aggregations data.
2) Two-tier using threadlocal sounds good. Can we do this idea:
interface QueryContext {
Connection getConnection(DataSource ds);
some sort of common filter for aggregation cache and hierarchy caches
void dispose();
}

class QueryContextImpl {
private HashMap<DataSource, Connection> openConnections = new HashMap<DataSource,Connection>();
public Connection getConnection(DataSource ds) {
Connection c = openConnections.get(ds);
if (c != null) {
return c;
}
try {
c = ds.getConnection();
openConnections.put(ds, c);
return c;
} catch (SQLException ex) {
throw new MondrianExceptionOrSomething(ex);
}
}
//TODO some filtering to the global aggregation and hierarchy caches
public void dispose() {
for (Connection c : openConnections.valueSet()) {
try {
c.close();
} catch (SQLException ex) {
log it ...
}
}
}
}

RolapResult.java:
{
private static ThreadLocal<QueryContext> qContext = new ThreadLocal<QueryContext>();
public static QueryContext getQueryContext() {
return qContext.get();
}
public RolapResult(...) {
...
if (!execute) {
return;
}
//Going to execute
QueryContext qc = createQueryContext();
qContext.set(qc);
try {
//Do execute stuff here
} finally {
qContext.clear();
qc.dispose();
}
...
}
//Use a property to override the class used? That way we can configure each Connection specifically?
public QueryContext createQueryContext() {
return new QueryContextImpl();
}
}
//All places in the code base that use DataSource to obtain a Connection in the context of a query should use:
Connection c = RolapResult.getQueryContext().getConnection(ds);

That way we only open one connection per query and we use the database's transaction system.

I found this hard to do because of the RolapConnection/RolapCube constructors calling each other somehow (can't remember the details).

Michael
----- Message d'origine ----
De : Julian Hyde <julianhyde (AT) speakeasy (DOT) net>

John V. Sichi
01-23-2007, 07:23 PM
michael bienstein wrote:
> Can you guys who can reproduce this bug modify the test to use a
> formatter for the null value? I would really like to know if it is a
> Java null, a nullValue() or what that is being formatted in the
> calculated measure's column there. This can be debugged without a
> debugger. If it is a null value of some sort we can trace back to where
> it came from in the code. I can't reproduce myself.

What's the best format_string expression to use for it ([Profit per Unit
Shipped])?

"with member [Measures].[Shipped per Ordered] as '
[Measures].[Unit\
s Shipped] / [Measures].[Unit Sales] ', format_string='#.00%'\n" +

" member [Measures].[Profit per Unit Shipped] as '
[Measures].[\
Profit] / [Measures].[Units Shipped] '\n" +

"select\n" +

" {[Measures].[Unit Sales], \n" +

" [Measures].[Units Shipped],\n" +

" [Measures].[Shipped per Ordered],\n" +

" [Measures].[Profit per Unit Shipped]} on 0,\n" +

" NON EMPTY Crossjoin([Product].Children,
[Time].[1997].Childre\
n) on 1\n" +

"from [Warehouse and Sales]",

JVS
_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian