Skip to content

Commit

Permalink
MONDRIAN: Tries to fix the cache test by sorting all the collections …
Browse files Browse the repository at this point in the history
…when printing the cache state.

[git-p4: depot-paths = "//open/mondrian/": change = 15003]
  • Loading branch information
lucboudreau committed Mar 15, 2012
1 parent 1b4e1dc commit b609443
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 86 deletions.
8 changes: 8 additions & 0 deletions src/main/mondrian/rolap/agg/SegmentCacheManager.java
Expand Up @@ -786,6 +786,14 @@ public PrintCacheStateCommand(
public Void call() {
final List<RolapStar> starList =
CacheControlImpl.getStarList(region);
Collections.sort(
starList,
new Comparator<RolapStar>() {
public int compare(RolapStar o1, RolapStar o2) {
return o1.getFactTable().getAlias().compareTo(
o2.getFactTable().getAlias());
}
});
for (RolapStar star : starList) {
indexRegistry.getIndex(star)
.printCacheState(pw);
Expand Down
31 changes: 27 additions & 4 deletions src/main/mondrian/rolap/cache/SegmentCacheIndexImpl.java
Expand Up @@ -363,13 +363,36 @@ private boolean intersects(

public void printCacheState(PrintWriter pw) {
checkThread();

for (List<SegmentHeader> headerList : bitkeyMap.values()) {
final List<List<SegmentHeader>> values =
new ArrayList<List<SegmentHeader>>(
bitkeyMap.values());
Collections.sort(
values,
new Comparator<List<SegmentHeader>>() {
public int compare(
List<SegmentHeader> o1,
List<SegmentHeader> o2)
{
if (o1.size() == 0) {
return -1;
}
if (o2.size() == 0) {
return 1;
}
return o1.get(0).getUniqueID()
.compareTo(o2.get(0).getUniqueID());
}
});
for (List<SegmentHeader> key : values) {
final List<SegmentHeader> headerList =
new ArrayList<SegmentHeader>(key);
Collections.sort(
headerList, new Comparator<SegmentHeader>() {
headerList,
new Comparator<SegmentHeader>() {
public int compare(SegmentHeader o1, SegmentHeader o2) {
return o1.getUniqueID().compareTo(o2.getUniqueID());
}});
}
});
for (SegmentHeader header : headerList) {
pw.println(header.getDescription());
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/mondrian/server/monitor/CellCacheEvent.java
Expand Up @@ -10,7 +10,6 @@
package mondrian.server.monitor;

import mondrian.olap.CacheControl;
import mondrian.server.Locus;

/**
* Event concerning the cell cache.
Expand All @@ -21,9 +20,12 @@ public abstract class CellCacheEvent extends ExecutionEvent {

/**
* Creates a CellCacheEvent.
*
* @param timestamp Timestamp
* @param locus Locus
* @param timestamp Timestamp of the event.
* @param serverId Server ID from which originated the event.
* @param connectionId Connection ID from which originated the event.
* @param statementId Statement ID from which originated the event.
* @param executionIdExecution ID from which originated the event.
* @param source The source of the event, being a value of Source.
*/
public CellCacheEvent(
long timestamp,
Expand Down

0 comments on commit b609443

Please sign in to comment.