sj_retry.sql 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. create table sj_retry
  2. (
  3. id bigint unsigned auto_increment comment '主键'
  4. primary key,
  5. namespace_id varchar(64) default '764d604ec6fc45f68cd92514c40e9e1a' not null comment '命名空间id',
  6. group_name varchar(64) not null comment '组名称',
  7. group_id bigint not null comment '组Id',
  8. scene_name varchar(64) not null comment '场景名称',
  9. scene_id bigint not null comment '场景ID',
  10. idempotent_id varchar(64) not null comment '幂等id',
  11. biz_no varchar(64) default '' not null comment '业务编号',
  12. executor_name varchar(512) default '' not null comment '执行器名称',
  13. args_str text not null comment '执行方法参数',
  14. ext_attrs text not null comment '扩展字段',
  15. next_trigger_at bigint not null comment '下次触发时间',
  16. retry_count int default 0 not null comment '重试次数',
  17. retry_status tinyint default 0 not null comment '重试状态 0、重试中 1、成功 2、最大重试次数',
  18. task_type tinyint default 1 not null comment '任务类型 1、重试数据 2、回调数据',
  19. bucket_index int default 0 not null comment 'bucket',
  20. parent_id bigint default 0 not null comment '父节点id',
  21. deleted bigint default 0 not null comment '逻辑删除',
  22. create_dt datetime default CURRENT_TIMESTAMP not null comment '创建时间',
  23. update_dt datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '修改时间',
  24. constraint uk_scene_tasktype_idempotentid_deleted
  25. unique (scene_id, task_type, idempotent_id, deleted)
  26. )
  27. comment '重试信息表';
  28. create index idx_biz_no
  29. on sj_retry (biz_no);
  30. create index idx_create_dt
  31. on sj_retry (create_dt);
  32. create index idx_idempotent_id
  33. on sj_retry (idempotent_id);
  34. create index idx_parent_id
  35. on sj_retry (parent_id);
  36. create index idx_retry_status_bucket_index
  37. on sj_retry (retry_status, bucket_index);