# RDB 校验和不匹配：预期 0xabc123 但实际为 0xdef456，可能检测到数据损坏或双重释放

- **ID:** `redis/rdb-load-corrupt-double-free`
- **领域:** redis
- **类别:** data_error
- **错误码:** `ERR`
- **验证级别:** ai_generated
- **修复率:** 70%

## 根因

RDB 文件的校验和与计算值不匹配，表明在写入、传输或存储过程中文件损坏，可能是转储过程中的双重释放内存错误所致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 6.2 | active | — | — |
| 7.0 | active | — | — |
| 7.2 | active | — | — |
| 8.0-m3 | active | — | — |

## 解决方案

1. ```
   Use the redis-check-rdb tool to repair the RDB file: redis-check-rdb --fix /path/to/dump.rdb
   ```
2. ```
   Restore from a known good backup taken before the corruption occurred. Example: copy backup.rdb to dump.rdb and restart Redis.
   ```
3. ```
   If the corruption is due to memory errors, run memtest on the server hardware and replace faulty RAM, then restore from backup.
   ```

## 无效尝试

- **Re-run the RDB save command to overwrite the corrupted file.** — If the corruption is due to underlying disk or memory issues, the new save may also be corrupted. (50% 失败率)
- **Use a backup RDB file from a different time without verifying its integrity.** — The backup may have the same corruption if it was written during the same problematic period. (40% 失败率)
- **Disable checksum verification in redis.conf by setting rdbchecksum no.** — This ignores the error but does not fix the corruption; loading corrupted data can cause crashes or data loss. (70% 失败率)
