Browse Source

[DS-6433][Improvement] find one command optimize without mybatis-plus (#6434)

Co-authored-by: caishunfeng <534328519@qq.com>
2.0.7-release
wind 3 years ago committed by GitHub
parent
commit
6dd0e050ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/CommandMapper.java
  2. 3
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml
  3. 3
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
  4. 3
      sql/dolphinscheduler_h2.sql
  5. 3
      sql/dolphinscheduler_mysql.sql
  6. 2
      sql/dolphinscheduler_postgre.sql

2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/CommandMapper.java

@ -56,6 +56,6 @@ public interface CommandMapper extends BaseMapper<Command> {
* query command page
* @return
*/
IPage<Command> queryCommandPage(IPage<Command> page);
List<Command> queryCommandPage(@Param("limit") int limit, @Param("offset") int offset);
}

3
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/CommandMapper.xml

@ -46,6 +46,7 @@
<select id="queryCommandPage" resultType="org.apache.dolphinscheduler.dao.entity.Command">
select *
from t_ds_command
order by update_time asc
order by process_instance_priority, id asc
limit #{limit} offset #{offset}
</select>
</mapper>

3
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

@ -308,8 +308,7 @@ public class ProcessService {
* @return
*/
public List<Command> findCommandPage(int pageSize, int pageNumber) {
Page<Command> commandPage = new Page<>(pageNumber, pageSize);
return commandMapper.queryCommandPage(commandPage).getRecords();
return commandMapper.queryCommandPage(pageSize, pageNumber * pageSize);
}
/**

3
sql/dolphinscheduler_h2.sql

@ -327,7 +327,8 @@ CREATE TABLE t_ds_command
process_instance_priority int(11) DEFAULT NULL,
worker_group varchar(64),
environment_code bigint(20) DEFAULT '-1',
PRIMARY KEY (id)
PRIMARY KEY (id),
KEY priority_id_index (process_instance_priority, id)
);
-- ----------------------------

3
sql/dolphinscheduler_mysql.sql

@ -333,7 +333,8 @@ CREATE TABLE `t_ds_command` (
`worker_group` varchar(64) COMMENT 'worker group',
`environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
`dry_run` int NULL DEFAULT 0 COMMENT 'dry run flag:0 normal, 1 dry run',
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
KEY `priority_id_index` (`process_instance_priority`,`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-- ----------------------------

2
sql/dolphinscheduler_postgre.sql

@ -258,6 +258,8 @@ CREATE TABLE t_ds_command (
PRIMARY KEY (id)
) ;
create index priority_id_index on t_ds_command (process_instance_priority,id);
--
-- Table structure for table t_ds_datasource
--

Loading…
Cancel
Save