feat: Enable batch import of SST files with S3/MinIO in Pika#3176
feat: Enable batch import of SST files with S3/MinIO in Pika#3176wangshao1 merged 3 commits intoOpenAtomFoundation:3.5-ospp-ingestfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
98896c4 to
8b43896
Compare
| @@ -0,0 +1,717 @@ | |||
| ########################### | |||
There was a problem hiding this comment.
这个文件是你跑demo的时候的配置文件吧?在pr里删掉吧。
| extern std::unique_ptr<PikaConf> g_pika_conf; | ||
|
|
||
| // Forward declarations | ||
| class PikaMigrateThread; |
There was a problem hiding this comment.
这个类你应该没用到吧?为什么这里需要前置声明?
There was a problem hiding this comment.
在623行有一个 std::unique_ptr<PikaMigrateThread> pika_migrate_thread_; 的成员变量,使用了PikaMigrateThread。
|
|
||
| // === InitS3 === | ||
| std::string s3_conf = g_pika_conf->s3_conf_path(); | ||
| auto s3_st = g_pika_server->InitS3(s3_conf); |
There was a problem hiding this comment.
这里建议加一个判断,如果没有s3相关配置,就不启动batch import功能。对应manifestcmd的处理逻辑直接返回not supported就可以。
因为不是所有的线上集群都需要开启这个功能,现在这种做法会导致pika强依赖一个s3组件。
|
|
||
| // 下载所有 SST | ||
| SstDownloader* downloader = g_pika_server->s3()->Downloader(); | ||
| rocksdb::Status s_ = downloader->DownloadAllFiles(key_, sst_files_path_); |
e15b426
into
OpenAtomFoundation:3.5-ospp-ingest
修改内容概述
当前分支
pika-ingest-v3.5相比于3.5分支,新增了 SST文件批量导入功能 (pika_batch_ingest),支持通过 S3/MinIO 等对象存储服务进行大规模数据的快速导入。该功能允许用户通过manifest文件批量导入大量 SST 文件到 Pika 数据库,并提供一个完整的批量数据生成和导入流水线系统。主要更改
新增核心功能模块
A. Manifest Ingest 功能
manifestingest命令,用于从 S3/MinIO 下载manifest文件并导入对应的 SST 文件ManifestIngestCmd类,负责下载和导入外部 SST 文件RedisStrings::SstExtendIngest方法中实现 SST 扩展导入逻辑B. S3 服务模块
src/ingest目录,包含完整的 S3 服务支持S3Service类,封装 AWS S3 客户端和传输管理器SstDownloader类,用于下载manifest和 SST 文件配置文件更新
A. 主配置文件
conf/pika.conf中新增ingest-conf-path配置项,指定 ingest 配置文件路径s3-conf-path配置项,用于 S3 访问配置B. S3 配置文件
新增
conf/s3.conf:定义 S3/MinIO 连接参数endpoint:S3 或 MinIO 服务地址region:区域设置bucket:存储桶名称access_key/secret_key:访问凭证transfer_threads、max_inflight等C. Ingest 配置文件
conf/ingest.conf:定义 ingest 过程中的 RocksDB 参数配置新增工具链
A. pika_batch_ingest 工具
B. Shell 脚本集合
run.sh、mock.sh、exchange.sh、s3put.sh、iagent.sh等代码架构改动
A. PikaServer 更新
PikaServer中新增S3Service成员变量InitS3()和StopS3()方法用于 S3 服务管理B. 存储层扩展
storage模块中新增SstExtendIngest接口C. 新增 proto 定义
manifest.proto定义manifest文件格式性能优化特性
A. 激进导入参数
B. 并发处理
集成测试
string_ingest.tcl测试文件manifestingest命令的正确性和数据完整性主要代码更新细节
A. pika.cc
B. pika_server.cc
StopS3()调用,确保 S3 服务正确关闭InitS3()和StopS3()方法C. pika_command.cc 和 pika_command.h
manifestingest命令D. pika_conf.cc 和 pika_conf.h
s3-conf-path和ingest-conf-path参数E. 全局变量声明更新
extern std::unique_ptr<PikaServer> g_pika_server;更改为extern PikaServer* g_pika_server;技术实现要点
manifest文件,解析后批量下载对应的 SST 文件checksums,支持阻塞刷新等选项,确保数据完整性manifestingest命令正确注册到命令表中,使其可以在 Redis 协议中使用此功能主要面向大规模数据导入场景,如数据迁移、冷热数据切换等,显著提高了大数据量导入的效率和可靠性。