Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 只通过cdc 写入的备份库,最近频繁出现region is unavaliable
【TiDB Usage Environment】Production
【TiDB Version】5.4.2
【Encountered Problem】
A downstream backup database, only for queries. Data is synchronized through CDC, and recently there has been frequent occurrences of region is unavailable, causing CDC to crash.
【Problem Phenomenon and Impact】
Region is unavailable appears,
Afterwards, etcd transactions frequently fail, causing CDC to be unavailable. Unable to pause tasks, skip abnormal tables.
CDC log
cdc.log.gz (2.0 MB)
Creating a new table causes the problem. The SQL is as follows:
Create table
CREATE TABLE `tbl_ad_video_callback_log1` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`appId` INT(11) DEFAULT NULL COMMENT 'Application ID',
`userId` INT(11) DEFAULT NULL COMMENT 'User ID',
`adCodeId` INT(11) DEFAULT NULL COMMENT 'Ad Code ID',
`dspId` INT(11) DEFAULT NULL COMMENT 'DSP ID',
`type` TINYINT(3) DEFAULT NULL COMMENT 'Processing type: 1 Parsing successful, 2 Parsing failed, 3 No parsing key',
`log` VARCHAR(500) DEFAULT NULL COMMENT 'Input information',
`create_time` DATETIME NOT NULL,
`platformId` INT(11) DEFAULT NULL COMMENT 'Platform ID',
PRIMARY KEY (`id`,create_time) /*T![clustered_index] CLUSTERED */,
KEY `idx_audp` (`appId`,`userId`,`dspId`,`platformId`)
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=20862102 COMMENT='Effective callback log information for incentive videos'
PARTITION BY RANGE COLUMNS(`create_time`)
(PARTITION `p20220817` VALUES LESS THAN ("20220818"),
PARTITION `p20220818` VALUES LESS THAN ("20220819"),
PARTITION `p20220819` VALUES LESS THAN ("20220820"),
PARTITION `p20220820` VALUES LESS THAN ("20220821"),
PARTITION `p20220821` VALUES LESS THAN ("20220822"),
PARTITION `p20220822` VALUES LESS THAN ("20220823"),
PARTITION `p20220823` VALUES LESS THAN ("20220824"),
PARTITION `p20220824` VALUES LESS THAN ("20220825"),
PARTITION `p20220825` VALUES LESS THAN ("20220826"),
PARTITION `p20220826` VALUES LESS THAN ("20220827"),
PARTITION `p20220827` VALUES LESS THAN ("20220828"),
PARTITION `p20220828` VALUES LESS THAN ("20220829"),
PARTITION `p20220829` VALUES LESS THAN ("20220830"),
PARTITION `p20220830` VALUES LESS THAN ("20220831"),
PARTITION `p20220831` VALUES LESS THAN ("20220901"))
Insert data
INSERT INTO tbl_ad_video_callback_log1 SELECT * FROM tbl_ad_video_callback_log WHERE create_time > ‘2022-08-17’;
ALTER TABLE tbl_ad_video_callback_log RENAME TO tbl_ad_video_callback_log_old;
ALTER TABLE tbl_ad_video_callback_log1 RENAME TO tbl_ad_video_callback_log
INSERT INTO tbl_ad_video_callback_log
SELECT a.* FROM tbl_ad_video_callback_log_old a LEFT JOIN tbl_ad_video_callback_log b
ON b.id=a.id WHERE a.create_time > ‘2022-08-18’
AND b.id IS NULL