Skip to content

Commit

Permalink
MONDRIAN:
Browse files Browse the repository at this point in the history
       AggTableManager
           Triggers check that RolapSchema is still in Pool prior
           to execution (if not, then trigger removes itself).
           This could happen if the RolapSchema is cleared but the
           garbage collector has not needed to remove the trigger
           associated with the, now removed, RolapSchema.

[git-p4: depot-paths = "//open/mondrian/": change = 3677]
  • Loading branch information
Richard Emberson committed Jun 9, 2005
1 parent 0b4a847 commit e8a5ed5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/main/mondrian/rolap/RolapSchema.java
Expand Up @@ -709,6 +709,9 @@ synchronized void remove(final String catalogName,
synchronized void clear() {
mapUrlToSchema.clear();
}
synchronized boolean contains(RolapSchema rolapSchema) {
return mapUrlToSchema.containsKey(rolapSchema.key);
}


/**
Expand Down Expand Up @@ -773,6 +776,9 @@ public static void flushSchema(final String catalogName,
public static void clearCache() {
Pool.instance().clear();
}
public static boolean cacheContains(RolapSchema rolapSchema) {
return Pool.instance().contains(rolapSchema);
}

public Cube lookupCube(final String cube, final boolean failIfNotFound) {
Cube mdxCube = lookupCube(cube);
Expand Down
40 changes: 32 additions & 8 deletions src/main/mondrian/rolap/aggmatcher/AggTableManager.java
Expand Up @@ -232,6 +232,17 @@ private void loadRolapStarAggregates() throws SQLException {
}
}
}
private boolean runTrigger() {
if (RolapSchema.cacheContains(schema)) {
return true;
} else {
// must remove triggers
deregisterTriggers();

return false;
}

}

/**
* Registers triggers for the following properties:
Expand Down Expand Up @@ -260,7 +271,9 @@ public int phase() {
public void executeTrigger(final String key,
final String value)
throws MondrianProperties.Trigger.VetoRT {
reOrderAggStarList();
if (AggTableManager.this.runTrigger()) {
reOrderAggStarList();
}
}
};
MondrianProperties.instance().addTrigger(trigger,
Expand All @@ -283,7 +296,9 @@ public int phase() {
public void executeTrigger(final String key,
final String value)
throws MondrianProperties.Trigger.VetoRT {
reLoadRolapStarAggregates();
if (AggTableManager.this.runTrigger()) {
reLoadRolapStarAggregates();
}
}
};
MondrianProperties.instance().addTrigger(trigger,
Expand All @@ -307,18 +322,27 @@ public int phase() {
public void executeTrigger(final String key,
final String value)
throws MondrianProperties.Trigger.VetoRT {
reLoadRolapStarAggregates();
System.out.println("AggTableManager.Trigger.executeTrigger: key="
+key
+", key"
+value
);
if (AggTableManager.this.runTrigger()) {
reLoadRolapStarAggregates();
}
}
};
MondrianProperties.instance().addTrigger(trigger,
MondrianProperties.ReadAggregates);
triggers[2] = trigger;
}
private void deregisterTriggers() {
MondrianProperties.instance().removeTrigger(triggers[0],
MondrianProperties.ChooseAggregateByVolume);

MondrianProperties.instance().addTrigger(triggers[1],
MondrianProperties.AggregateRules);
MondrianProperties.instance().addTrigger(triggers[1],
MondrianProperties.AggregateRuleTag);

MondrianProperties.instance().addTrigger(triggers[2],
MondrianProperties.ReadAggregates);
}
private Iterator getStars() {
return schema.getStars();
}
Expand Down

0 comments on commit e8a5ed5

Please sign in to comment.