-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] <title> After deleting the monitor, adding a monitor with the same name will report an error #1146
Comments
谢谢反馈 收到 |
Thank you for your feedback |
![image](https://github.com/dromara/hertzbeat/assets/48920254/28d59dd2-e7b0-4e52-b28e-dee4f8109e1 |
麻烦顺带贴一下hzb_tag的表结构 |
Please post the table structure of hzb_tag by the way |
标签我没用,数据是空的。 CREATE TABLE `hzb_tag` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'TAG ID',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'TAG标签名称',
`value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'TAG标签值(可为空)',
`type` tinyint NOT NULL DEFAULT 0 COMMENT '标记类型 0:监控自动生成(monitorId,monitorName) 1: 用户生成 2: 系统预制',
`color` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '#ffffff' COMMENT '标签颜色',
`creator` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建者',
`modifier` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '最新修改者',
`gmt_create` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`gmt_update` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_tag`(`name` ASC, `value` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; |
The tags I have are useless and the data is empty. CREATE TABLE `hzb_tag` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'TAG ID',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'TAG tag name',
`value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'TAG tag value (can be empty)',
`type` tinyint NOT NULL DEFAULT 0 COMMENT 'Mark type 0: monitor auto-generated (monitorId,monitorName) 1: user-generated 2: system prefabricated',
`color` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '#ffffff' COMMENT 'label color',
`creator` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'creator',
`modifier` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'latest modifier',
`gmt_create` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`gmt_update` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_tag`(`name` ASC, `value` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; |
奇怪,hzb_tag这个表里面有数据,这表不是对应管理后台里的标签管理吗。那边列表是空,为什么表里有数据? |
Strangely, there is data in the hzb_tag table. Doesn’t this table correspond to the tag management in the management background? The list over there is empty, why is there data in the table? |
Your code judges whether there is the same name in the monitor table. But the exception is in the hzb_tag table. Is the data in the hzb_tag table omitted when deleting the monitoring? In addition, the two intermediate tables should also be deleted. |
The code is to judge that the monitor table has the same name. The problem is that if the name is the same, an exception will be thrown directly. It will not go to the operation of inserting the hzb_tag table below; the current logic does not support the insertion of monitors with the same name. According to your description, it will be over when you go to the code position. The error reported in the previous screenshot is returned, not the error reported by the tag table insertion failure. |
Sorry, I missed the content in the post, but I actually wrote it in the title. My operation is to build a monitor called abc. Then delete it, and when creating an abc monitor, an error will be reported. I'll go back and record a video |
Okay, I understand, there is no need to record video, there is a problem, let’s fix it here |
fix by v1.4.0 |
fix by v1.4.0 |
Is there an existing issue for this?
Current Behavior
比如新建了一个监控,监控名称是:操作日志_192.168.21.228 。 然后再新建名称一样就报错.
Expected Behavior
不要报错
Steps To Reproduce
No response
Environment
Debug logs
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: