oceanbase / odc

OceanBase Developer Center(ODC), An open-source, enterprise-grade database tool for collaborative development
https://github.com/oceanbase/odc
Apache License 2.0
539 stars 58 forks source link

[Bug]: The archive table contains 10 million records, but only 10,000 records are actually archived. #3912

Open Huangxiao-mas opened 4 days ago

Huangxiao-mas commented 4 days ago

ODC version

ODC433

OB version

independent

What happened?

The archive table contains 10 million records, but only 10,000 records are actually archived. image image image

What did you expect to happen?

How can we reproduce it (as minimally and precisely as possible)?

chat privately

CREATE TABLE `order_main` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `transaction_id` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '交易Id.由PAD产生一个唯一的交易ID供交易超时异常重查接口使用,以PAD+门店ID+ExpenseInfoSync开头',
  `operator_id` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作员.操作员',
  `customer_key` varchar(30) COLLATE utf8mb4_bin NOT NULL COMMENT '客户键值.用户ID',
  `mobile_no` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '手机号.手机号用于异常问题补录积分的情况,其他情况传客户键值',
  `account_type` varchar(1) COLLATE utf8mb4_bin DEFAULT '1' COMMENT '类型.正常结账:1,补录:2',
  `order_source` varchar(30) COLLATE utf8mb4_bin NOT NULL COMMENT '订餐来源.1:网上订餐,2:支付宝订餐,3:微信订餐,4:电话订餐,5:门店订餐,6:手机终端订餐,7:百度轻应用订餐,8:百度地图PC订餐,9:贴吧PC订餐,10:贴吧移动订餐',
  `expense_id` varchar(60) COLLATE utf8mb4_bin NOT NULL COMMENT '结账单号.',
  `order_id` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '预订订单号.',
  `create_date` datetime DEFAULT NULL COMMENT '就餐日期(结账时间).时间格式:MM/DD/YYYY hh:mm:ss',
  `table_open_time` datetime DEFAULT NULL COMMENT '开台时间.时间格式:MM/DD/YYYY hh:mm:ss',
  `repast_person_num` int(3) DEFAULT NULL COMMENT '就餐人数.',
  `expense_time` varchar(22) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '消费时长.结账时间-开台时间并换算成分钟',
  `receivable_amt` decimal(15,6) NOT NULL COMMENT '消费金额(应收).',
  `receipt_amt` decimal(15,6) NOT NULL COMMENT '消费金额(实收).',
  `currency_cd` varchar(20) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '币种',
  `country` varchar(30) COLLATE utf8mb4_bin NOT NULL COMMENT '国家.CN:中国,SG:新加坡,KR:韩国,US:美国,CA:加拿大',
  `store_id` varchar(30) COLLATE utf8mb4_bin NOT NULL COMMENT '门店编码.对应机构ID',
  `store_name` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '门店名字,冗余',
  `is_self` varchar(1) COLLATE utf8mb4_bin DEFAULT 'Y' COMMENT '是否本人.Y表示是本人,N表示非本人',
  `waiter_name` varchar(35) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '服务员名',
  `table_id` varchar(30) COLLATE utf8mb4_bin NOT NULL COMMENT '桌位号.',
  `discount_amount` varchar(22) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '折扣.',
  `discount_reason` varchar(250) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '折扣原因.',
  `aa_flag` varchar(1) COLLATE utf8mb4_bin DEFAULT 'N' COMMENT '是否AA制.Y:是,N:否',
  `expense_type` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '就餐类型.1:商务聚餐、2:生日聚餐、3:家庭聚餐、4:朋友聚餐、5:同学聚会、6:节日聚餐、7:情侣就餐、8:结婚纪念日',
  `feature` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '扩展字段',
  `gmt_create` datetime NOT NULL COMMENT '创建时间',
  `gmt_modify` datetime NOT NULL COMMENT '修改时间',
  `comment` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '评论',
  `star` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '星级',
  `is_evaluate` tinyint(1) DEFAULT '0' COMMENT '是否评论',
  `sync_time` int(8) DEFAULT NULL COMMENT '数据迁移分批标记',
  `email` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
  `service_star` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '服务满意度',
  `dish_star` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '菜品满意度',
  `envir_star` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL,
  `speed_star` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL,
  `version` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '账单版本',
  `discount_amt` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '优惠金额',
  `cipher_email` varchar(255) COLLATE utf8mb4_bin DEFAULT '' COMMENT '加密邮箱',
  `cipher_mobile_no` varchar(255) COLLATE utf8mb4_bin DEFAULT '' COMMENT '加密手机号',
  PRIMARY KEY (`id`, `customer_key`),
  UNIQUE KEY `id` (`id`) BLOCK_SIZE 16384 GLOBAL,
  KEY `auto_shard_key_customer_key` (`customer_key`) BLOCK_SIZE 16384 LOCAL,
  KEY `index_sync_time` (`sync_time`) BLOCK_SIZE 16384 LOCAL,
  KEY `gmt_modify` (`gmt_modify`) BLOCK_SIZE 16384 LOCAL,
  KEY `create_date` (`create_date`) BLOCK_SIZE 16384 LOCAL,
  KEY `expense_id` (`expense_id`) BLOCK_SIZE 16384 LOCAL
) AUTO_INCREMENT = 1218809109 AUTO_INCREMENT_MODE = 'ORDER' DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
 partition by range(id)
(partition `p0` values less than (10000),
partition `p1` values less than (100000),
partition `p2` values less than (MAXVALUE))

Anything else we need to know?

No response

Huangxiao-mas commented 4 days ago

Partition information is unreliable when the plan exists in the table