任务描述

1.背景:

  消息队列执行成功的数据,保存太久太多影响webapi的性能,占用了存储空间,未来形成数据逻辑闭环,需要清除。


2.任务描述:

各平台保存MQ消息表执行成功的数据(status=1)删除服务:逻辑:


1.从mq_msg_fail_config 里获取队列表名BusinessTable 列表;
2.循环列表,删除已执行成功的前7天的所有队列数据
delete m_shopeev2_synclisting(BusinessTable)
where `Status`=1 and LastModificationTime < (nowdate - 7天)
3.删除前手动检测确认一下各BusinessTable 里的status=1 是执行成功的状态,只删除执行成功的数据(0:初始状态;1执行成功;2执行失败)


参考任务:http://pm.zhcxkj.com/zentao/task-view-36585.html


历史记录  
  1. 2023-06-26 10:05:23, 由 刘瀚泽 创建。
  2. 2023-06-26 10:05:40, 由 刘瀚泽 编辑。
    修改了 所属模块,旧值为 "0",新值为 "1659"。
  3. 2023-06-26 10:11:14, 由 刘瀚泽 指派给 吴高发。
    修改了 指派给,旧值为 "chengwei",新值为 "wugaofa"。
  4. 2023-06-26 17:00:44, 由 吴高发 添加备注。
    m_shopeev2_synclisting
    m_mercadolibre_synclisting
    m_allegro_synclisting
    m_aliexpress_synclisting
    m_allegro_syncautopublish
    m_mercadolibre_syncautopublish

    条件: where `Status`=1 and LastModificationTime < convert(ADDDATE(now(),-7),date)

    清理完成。

    具体看钉钉聊天记录(智能刊登 数据库归档 沟通群)

  5. 2023-06-26 17:03:03, 由 吴高发 完成。
    修改了 总计消耗,旧值为 "0",新值为 "5"。
    修改了 指派给 ,旧值为 "wugaofa",新值为 "liuhanze"。
    修改了 实际完成,旧值为 "",新值为 "2023-06-26 17:01:10"。
    修改了 任务状态,旧值为 "wait",新值为 "done"。
    修改了 实际开始,旧值为 "0000-00-00 00:00:00",新值为 "2023-06-26 17:03:03"。
    修改了 预计剩余,旧值为 "4",新值为 "0"。
    修改了 由谁完成,旧值为 "",新值为 "wugaofa"。
  6. 2023-06-28 09:31:57, 由 陈少军 添加备注。

    归档了队列表里状态为1的数据后,数据对比:

    select count(*) from m_shopeev2_synclisting           -- 27496715  2.7千万  归档后 2988322
    select count(*) from m_mercadolibre_synclisting       -- 187906359 1.8亿  归档后  87726619
    select count(*) from m_allegro_synclisting            -- 110074492 1.1亿 (status=0 4017908)归档后  15105761
    select count(*) from m_allegro_synclisting where status=0 -- 4017908
    select count(*) from m_aliexpress_synclisting         -- 28685541  2.8千万  归档后 16845450
    select count(*) from m_allegro_syncautopublish        -- 10978450  1.09千万  归档后1257219
    select count(*) from m_mercadolibre_syncautopublish   -- 17147625  1.7千万  归档后 14126617

    下次归档可是把状态不等于0的+7天前的都归档了,这样数据归档的更多:

    条件: where `Status`!=0 and LastModificationTime < convert(ADDDATE(now(),-7),date)

  7. 2023-06-28 18:40:29, 由 刘瀚泽 关闭。
    修改了 任务状态,旧值为 "done",新值为 "closed"。
    修改了 指派给 ,旧值为 "liuhanze",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "liuhanze"。
    修改了 关闭时间,旧值为 "0000-00-00 00:00:00",新值为 "2023-06-28 18:40:29"。
    修改了 关闭原因,旧值为 "",新值为 "done"。
所属迭代 系统管理部 - 系统服务优化
所属模块 /
相关需求 暂无
指派给 Closed 于 2023-06-28 18:40:29
任务类型 运维
任务标签 初始
开发组 有品开发组
任务状态 已关闭
进度 100%
优先级 P2
关键词
抄送给 程伟 陈少军
由谁创建 刘瀚泽 于 2023-06-26 10:05:23
由谁完成 吴高发 于 2023-06-26 17:01:10
由谁取消 暂无
由谁关闭 刘瀚泽 于 2023-06-28 18:40:29
关闭原因 已完成
最后编辑 刘瀚泽 于 2023-06-28 18:40:29
团队 最初预计 总计消耗 预计剩余
工时信息
最初预计 4工时
总计消耗 5工时
预计剩余 0工时
预计开始 2023-06-27
实际开始 2023-06-26
截止日期 2023-06-27