Skip to content

Conversation

@ZhangZui123
Copy link

@ZhangZui123 ZhangZui123 commented Sep 23, 2025

Description

本 PR 基于分支 backup/snapshot_20250912_204521,在 plugins/incremental_bitmap 实现并验证以“逻辑快照 + 增量(WAL/脏块)”为核心的时间点恢复(PITR)链路,聚焦兼容性、高性能、可靠性与可扩展性的落地与可复现校验。

兼容性

  • 通过备份协调器提供按 WAL 偏移与按时间范围的增量块查询与规模估算接口:backup_coordinator_get_dirty_blocks、backup_coordinator_get_dirty_blocks_by_time、backup_coordinator_estimate_backup_size(src/backup_coordinator.c / include/backup_coordinator.h)。
  • 事件拦截与位图联动:EVENT_BLOCK_CREATE/UPDATE/FLUSH/DELETE 触发位图状态更新(src/event_interceptor.c 调用 bitmap_engine_*),为“快照 + 增量”恢复提供脏块定位能力。
  • 提供真实环境用例与闭环比对:test/test_e2e_tdengine_real.c 调用同目录二进制 ./test_taosdump_comparison,将结果写入 /tmp/test_taosdump_comparison_inline.log 并计入总判定;test/test_taosdump_comparison.c 负责建数、调用 taosdump 导出与比对。

高性能

  • 位图核心引擎与压缩实现:src/bitmap_engine.c、src/roaring_bitmap.c,支持按 WAL/时间的双通道脏块获取与批量查询。
  • 单测覆盖:test/test_bitmap_engine_core.c、test/test_roaring_bitmap_specific.c 验证脏块查询与位图行为。

高可靠

端到端测试严格化

  • test/test_pitr_e2e.c 统一 PITR_DEFAULT_CONFIG,移除宽松判断;
  • 乱序/删除采用计数与一致性硬断言;
  • generate_detailed_test_report(total,passed,failed) 生成 /tmp/pitr_detailed_report.txt。

真实环境脚本校验:run_real_tests.sh

  • 每个测试输出至 logs/.log;
  • 对 test_taosdump_comparison 强制匹配成功关键词(含中英文);
  • 在 test_e2e_tdengine_real 后校验产物目录与报告文件存在且非零,并在 /tmp/pitr_detailed_report.txt 校验关键字段(Total/Passed/Success Rate)。

非真实环境脚本:run_tests.sh

  • 固定可执行测试集、避免“假绿”;
  • 可选 Valgrind 覆盖 test_bitmap_engine_core、test_backup_coordinator、test_skiplist、test_ring_buffer,输出至 valgrind_logs/*.log。

可扩展

  • 接口化设计:存储引擎抽象、事件拦截器、位图引擎与备份协调器分层实现(include/.h、src/.c),方便与上层备份工具对接。
  • CI/workflow:plugins/incremental_bitmap/.github/workflows/ci.yml 提供参数化开关、步骤化准备与超时设置;如运行受限,可用本地脚本复现闭环与产物校验。

复现入口

  • Mock/单元与集成:plugins/incremental_bitmap/run_tests.sh
  • 真实环境与闭环:plugins/incremental_bitmap/run_real_tests.sh

Checklist

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

本PR为TDengine增量位图插件实现了完整的逻辑备份和恢复功能,基于"逻辑快照 + 增量(WAL/脏块)"架构,重点关注兼容性、高性能、可靠性与可扩展性。核心变更包括:

  • 实现了插件核心组件:位图引擎、事件拦截器、备份协调器等
  • 提供了TDengine TMQ存储引擎适配,支持实时事件消费
  • 完善了测试覆盖,包括单元测试、集成测试和端到端测试
  • 添加了taosX插件技术预览接口
  • 集成了可观测性指标收集与输出

Reviewed Changes

Copilot reviewed 59 out of 90 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/test_backup_coordinator.c 备份协调器测试,涵盖初始化、脏块获取、游标操作等核心功能
test/test_abstraction_layer.c 位图接口抽象层测试,验证工厂模式和环境变量控制
test/pitr_e2e_test.c 时间点恢复端到端测试,包含数据量检查和性能验证
test/mock_storage_engine.c Mock存储引擎实现,用于测试环境
test/e2e_perf.c 端到端性能测试工具
test/e2e_consistency.c 端到端一致性验证工具
taosx_plugin/*.c/.h taosX插件接口技术预览实现
src/*.c 核心组件实现:存储引擎、位图引擎、事件拦截器等
Comments suppressed due to low confidence (1)

plugins/incremental_bitmap/src/tdengine_storage_engine.c:1

  • The trailing comma after config->recovery_path should be removed as this is the last member being initialized in the struct initializer.
#include "storage_engine_interface.h"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@CLAassistant
Copy link

CLAassistant commented Oct 1, 2025

CLA assistant check
All committers have signed the CLA.

@zyyang90 zyyang90 self-assigned this Oct 28, 2025
@zyyang90 zyyang90 force-pushed the backup/snapshot_20250912_204521 branch from 65a7b5c to 4aaa55e Compare October 28, 2025 02:57
@ZhangZui123 ZhangZui123 force-pushed the backup/snapshot_20250912_204521 branch from 4aaa55e to 0d2b638 Compare October 28, 2025 07:50
@ZhangZui123 ZhangZui123 changed the base branch from main to research/3.3.6-experimental October 28, 2025 07:56
@zyyang90 zyyang90 merged commit 0d2b638 into taosdata:research/3.3.6-experimental Oct 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants