REQ-2135: 更新batchSize
This commit is contained in:
parent
a481fc407d
commit
10eaebdd40
@ -69,6 +69,28 @@ public class MigrateFromPendingMessageJob extends IJobHandler {
|
||||
try {
|
||||
log.info("开始执行...");
|
||||
MigrateCount migrateCount = new MigrateCount();
|
||||
|
||||
List<Long> businessIds;
|
||||
QueryWrapper<Todo> todoQuery = new QueryWrapper<Todo>()
|
||||
.select("DISTINCT todo_business_id")
|
||||
.last("AND biz_code <> '' AND record_ext -> '$.isMigratedFromPendingMessage' = true");
|
||||
businessIds = todoDao.list(todoQuery).stream()
|
||||
.map(Todo::getTodoBusinessId)
|
||||
.collect(toList());
|
||||
log.info("remove businessIds:{}", JSON.toJSONString(businessIds));
|
||||
|
||||
if (!businessIds.isEmpty()) {
|
||||
for (List<Long> batch : Lists.partition(businessIds, 2000)) {
|
||||
int removedBusiness = todoBusinessDao.getBaseMapper().deleteByIds(batch);
|
||||
log.info("remove businessIds:{}, count={}", JSON.toJSONString(batch), removedBusiness);
|
||||
}
|
||||
}
|
||||
|
||||
int removedTodo = todoDao.getBaseMapper().delete(
|
||||
query(Todo.class)
|
||||
.last("AND record_ext -> '$.isMigratedFromPendingMessage' = true"));
|
||||
log.info("remove todos count={}", removedTodo);
|
||||
|
||||
new MigrateBizCodePresentAction(migrateCount).compute();
|
||||
new MigrateBizCodeAbsentAction(migrateCount).compute();
|
||||
log.info("迁移结束, migrateCount={}", migrateCount);
|
||||
|
||||
@ -2,9 +2,15 @@ package cn.axzo.msg.center.dal.mapper;
|
||||
|
||||
import cn.axzo.msg.center.domain.entity.TodoBusiness;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
*/
|
||||
public interface TodoBusinessMapper extends BaseMapper<TodoBusiness> {
|
||||
|
||||
int deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.axzo.msg.center.dal.mapper.TodoBusinessMapper">
|
||||
|
||||
<delete id="deleteByIds">
|
||||
delete from todo_business WHERE id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user