Browse Source
* update english documents * refactor zk client * update documents * update zkclient * update zkclient * update documents * add architecture-design * change i18n * update i18n * update english documents * add architecture-design * update english documents * update en-US documents * add architecture-design * update demo site * add mybatis plus model * modify mybatisplus * modify mybatisplus * change interface by mybatisplus * add unit test * refactor dao interface. * add unit test for dao... * add unit test for dao... * add unit test for dao... * Merge remote-tracking branch 'upstream/dev-db' into dev-db # Conflicts: # dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProjectMapper.xml # dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ScheduleMapper.xml # escheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProcessInstanceMapper.xml # escheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProjectUserMapper.xml # escheduler-dao/src/main/resources/cn.escheduler.dao.mapper/QueueMapper.xml # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ProcessInstanceMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ProjectUserMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/QueueMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ResourceUserMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ScheduleMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/SessionMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/TenantMapperTest.java * Merge remote-tracking branch 'upstream/dev-db' into dev-db # Conflicts: # dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProjectMapper.xml # dolphinscheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ScheduleMapper.xml # escheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProcessInstanceMapper.xml # escheduler-dao/src/main/resources/cn.escheduler.dao.mapper/ProjectUserMapper.xml # escheduler-dao/src/main/resources/cn.escheduler.dao.mapper/QueueMapper.xml # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ProcessInstanceMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ProjectUserMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/QueueMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ResourceUserMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/ScheduleMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/SessionMapperTest.java # escheduler-dao/src/test/java/cn/escheduler/dao/mapper/TenantMapperTest.java * Merge remote-tracking branch 'upstream/dev-db' into dev-db # Conflicts: # dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml # dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml # dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.xml * update some dao bugs * update for some bugs * update some bugs * Merge remote-tracking branch 'upstream/dev-db' into dev-db # Conflicts: # dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml # dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml # dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.xml * update * update * add multiply settings for application.yml * add multiply settings for application.yml * revert * update configuration settings in task record dao... * change application_master to application-master * change application_master to application-master * update application.yml to application.properties * revert * revert * add properties * add properties * revert * revert * add api start up.. add alert send try catch * update dao info level * fix bug: task cannot submit when recovery failover * fix bug: task cannot submit when recovery failover * merge from dev-db * revert * revert * fix bug: get process definition list failed. * fix bug: process instance interval is error * revert * revert * update * support stop submit success tasks * update kill process * update for stop process * update for stop process * add some logs for stop process * update for small bug. * add check strategy before submit task * revert * update * update * revert * wait task instance exists if null. * revert * update * change desc to description. * add check user and definitions function when delete tenant * update * change desc to description. * change desc to description. * change desc to description. * remove check resources when delete tenant * change desc to description. * change mybatisplus version to 3.2.0 * update * change the notice to apache. * update * update postgre sql * fix bug: phone can be empty. * fix bug: postgre test error. * update create table for postgre quartz * fix some bugs about postgre. * update create table for postgre quartz * add postgre db performance monitor * add postgre performance monitor * update performance monitor * revert * revertpull/2/head
6 changed files with 252 additions and 86 deletions
@ -0,0 +1,35 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.dolphinscheduler.dao.utils; |
||||
|
||||
import org.apache.dolphinscheduler.dao.entity.MonitorRecord; |
||||
|
||||
import java.sql.Connection; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public abstract class BaseDBPerformance { |
||||
|
||||
|
||||
/** |
||||
* return the current database performance |
||||
* @return |
||||
*/ |
||||
protected abstract MonitorRecord getMonitorRecord(Connection conn); |
||||
|
||||
} |
@ -0,0 +1,83 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.dolphinscheduler.dao.utils; |
||||
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.DbType; |
||||
import org.apache.dolphinscheduler.common.enums.Flag; |
||||
import org.apache.dolphinscheduler.dao.MonitorDBDao; |
||||
import org.apache.dolphinscheduler.dao.entity.MonitorRecord; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.sql.Connection; |
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.sql.Statement; |
||||
import java.util.Date; |
||||
|
||||
import static org.apache.dolphinscheduler.dao.MonitorDBDao.VARIABLE_NAME; |
||||
|
||||
public class MysqlPerformance extends BaseDBPerformance{ |
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(MonitorDBDao.class); |
||||
|
||||
|
||||
@Override |
||||
public MonitorRecord getMonitorRecord(Connection conn) { |
||||
MonitorRecord monitorRecord = new MonitorRecord(); |
||||
monitorRecord.setDate(new Date()); |
||||
monitorRecord.setDbType(DbType.MYSQL); |
||||
monitorRecord.setState(Flag.YES); |
||||
Statement pstmt= null; |
||||
try{ |
||||
pstmt = conn.createStatement(); |
||||
|
||||
ResultSet rs1 = pstmt.executeQuery("show global variables"); |
||||
while(rs1.next()){ |
||||
if(rs1.getString(VARIABLE_NAME).toUpperCase().equals("MAX_CONNECTIONS")){ |
||||
monitorRecord.setMaxConnections( Long.parseLong(rs1.getString("value"))); |
||||
} |
||||
} |
||||
|
||||
ResultSet rs2 = pstmt.executeQuery("show global status"); |
||||
while(rs2.next()){ |
||||
if(rs2.getString(VARIABLE_NAME).toUpperCase().equals("MAX_USED_CONNECTIONS")){ |
||||
monitorRecord.setMaxUsedConnections(Long.parseLong(rs2.getString("value"))); |
||||
}else if(rs2.getString(VARIABLE_NAME).toUpperCase().equals("THREADS_CONNECTED")){ |
||||
monitorRecord.setThreadsConnections(Long.parseLong(rs2.getString("value"))); |
||||
}else if(rs2.getString(VARIABLE_NAME).toUpperCase().equals("THREADS_RUNNING")){ |
||||
monitorRecord.setThreadsRunningConnections(Long.parseLong(rs2.getString("value"))); |
||||
} |
||||
} |
||||
}catch (Exception e) { |
||||
monitorRecord.setState(Flag.NO); |
||||
logger.error("SQLException " + e); |
||||
}finally { |
||||
try { |
||||
if (pstmt != null) { |
||||
pstmt.close(); |
||||
} |
||||
}catch (SQLException e) { |
||||
logger.error("SQLException ", e); |
||||
} |
||||
} |
||||
return monitorRecord; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,76 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.dolphinscheduler.dao.utils; |
||||
|
||||
import org.apache.dolphinscheduler.common.enums.DbType; |
||||
import org.apache.dolphinscheduler.common.enums.Flag; |
||||
import org.apache.dolphinscheduler.dao.MonitorDBDao; |
||||
import org.apache.dolphinscheduler.dao.entity.MonitorRecord; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.sql.Connection; |
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.sql.Statement; |
||||
import java.util.Date; |
||||
|
||||
public class PostgrePerformance extends BaseDBPerformance { |
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(MonitorDBDao.class); |
||||
|
||||
@Override |
||||
public MonitorRecord getMonitorRecord(Connection conn) { |
||||
MonitorRecord monitorRecord = new MonitorRecord(); |
||||
monitorRecord.setDate(new Date()); |
||||
monitorRecord.setState(Flag.YES); |
||||
monitorRecord.setDbType(DbType.POSTGRESQL); |
||||
Statement pstmt= null; |
||||
try{ |
||||
pstmt = conn.createStatement(); |
||||
ResultSet rs1 = pstmt.executeQuery("select count(*) from pg_stat_activity;"); |
||||
while(rs1.next()){ |
||||
monitorRecord.setThreadsConnections(rs1.getInt("count")); |
||||
break; |
||||
} |
||||
|
||||
ResultSet rs2 = pstmt.executeQuery("show max_connections"); |
||||
while(rs2.next()){ |
||||
monitorRecord.setMaxConnections( rs2.getInt("max_connections")); |
||||
break; |
||||
} |
||||
|
||||
ResultSet rs3 = pstmt.executeQuery("select count(*) from pg_stat_activity pg where pg.state = 'active';"); |
||||
while(rs3.next()){ |
||||
monitorRecord.setThreadsRunningConnections(rs3.getInt("count")); |
||||
break; |
||||
} |
||||
}catch (Exception e) { |
||||
monitorRecord.setState(Flag.NO); |
||||
logger.error("SQLException " + e); |
||||
}finally { |
||||
try { |
||||
if (pstmt != null) { |
||||
pstmt.close(); |
||||
} |
||||
}catch (SQLException e) { |
||||
logger.error("SQLException ", e); |
||||
} |
||||
} |
||||
return monitorRecord; |
||||
} |
||||
} |
Loading…
Reference in new issue