use of com.actiontech.dble.config.model.ERTable in project dble by actiontech.
the class ERJoinChooser method leftJoinOptimizer.
/* ------------------- left join optimizer start -------------------- */
/**
* left join's ER is different from inner join's
* ex:t1,t2 ,if t1 left join t2 on
* t1.id=t2.id can be pushed
* < we cna't change left join's structure>
*
* @return
*/
private JoinNode leftJoinOptimizer() {
PlanNode left = jn.getLeftNode();
PlanNode right = jn.getRightNode();
if (left.type() == PlanNode.PlanNodeType.JOIN) {
left = JoinERProcessor.optimize(left);
jn.setLeftNode(left);
}
if (right.type() == PlanNode.PlanNodeType.JOIN) {
right = JoinERProcessor.optimize(right);
jn.setRightNode(right);
}
for (ItemFuncEqual filter : jn.getJoinFilter()) {
ERTable leftER = getLeftOutJoinChildER(jn, left, filter.arguments().get(0));
ERTable rightER = getLeftOutJoinChildER(jn, right, filter.arguments().get(1));
if (isErRelation(leftER, rightER)) {
jn.getERkeys().add(leftER);
}
}
return jn;
}
use of com.actiontech.dble.config.model.ERTable in project dble by actiontech.
the class RollbackConfig method rollback.
public static void rollback() throws Exception {
ServerConfig conf = DbleServer.getInstance().getConfig();
Map<String, PhysicalDBPool> dataHosts = conf.getBackupDataHosts();
Map<String, UserConfig> users = conf.getBackupUsers();
Map<String, SchemaConfig> schemas = conf.getBackupSchemas();
Map<String, PhysicalDBNode> dataNodes = conf.getBackupDataNodes();
FirewallConfig firewall = conf.getBackupFirewall();
Map<ERTable, Set<ERTable>> erRelations = conf.getBackupErRelations();
boolean backDataHostWithoutWR = conf.backDataHostWithoutWR();
if (conf.canRollback()) {
conf.rollback(users, schemas, dataNodes, dataHosts, erRelations, firewall, backDataHostWithoutWR);
} else if (conf.canRollbackAll()) {
boolean rollbackStatus = true;
String errorMsg = null;
for (PhysicalDBPool dn : dataHosts.values()) {
dn.init(dn.getActiveIndex());
if (!dn.isInitSuccess()) {
rollbackStatus = false;
errorMsg = "dataHost[" + dn.getHostName() + "] inited failure";
break;
}
}
// INIT FAILED
if (!rollbackStatus) {
for (PhysicalDBPool dn : dataHosts.values()) {
dn.clearDataSources("rollbackup config");
dn.stopHeartbeat();
}
throw new Exception(errorMsg);
}
final Map<String, PhysicalDBPool> cNodes = conf.getDataHosts();
// apply
conf.rollback(users, schemas, dataNodes, dataHosts, erRelations, firewall, backDataHostWithoutWR);
// stop old resource heartbeat
for (PhysicalDBPool dn : cNodes.values()) {
dn.clearDataSources("clear old config ");
dn.stopHeartbeat();
}
AlarmAppender.rollbackConfig();
} else {
throw new Exception("there is no old version");
}
}
Aggregations