pika icon indicating copy to clipboard operation
pika copied to clipboard

feat: pika-migrate tools support pika-v4.0.0

Open pro-spild opened this issue 11 months ago • 5 comments

feature 基于unstable分支更改的,支持pika-v4.0.0的pika-mgrate工具

Summary by CodeRabbit

  • New Features

    • Major upgrade to Pika 4.0.0, introducing a new migration tool to transfer data seamlessly from Pika to Redis. The tool supports both full and incremental synchronizations for single-instance, single-database setups.
    • New configuration options allow users to specify target Redis host, port, password, batch sizes, and migration thread counts.
  • Refactor & Modernization

    • Extensive internal refactoring has improved thread management, memory safety, and ACL/command handling to enhance overall performance and stability.

pro-spild avatar Jan 03 '25 11:01 pro-spild

[!IMPORTANT]

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request overhauls the pika_migrate module by introducing a new subdirectory in the build, eliminating several obsolete CI, configuration, and documentation files, and significantly enhancing the build configuration via CMake. Numerous header and source files have been added or updated to implement new features such as ACL management, advanced replication and migration threads, rsync‐based synchronization, and revised command interfaces. Major API changes include switching from “pink” to “net” and updating flag types from uint16_t to uint32_t. The version has been bumped from 3.2.7 to 4.0.0, and new documentation for a Pika‑to‑Redis migration tool is included.

Changes

File(s) Change Summary
tools/CMakeLists.txt Added new subdirectory inclusion for the pika_migrate module.
tools/pika_migrate/{.gitattributes, .gitignore, .travis.yml, CODE_OF_CONDUCT.md, CONTRIBUTING.md, Dockerfile, LICENSE, Makefile, README.md, pikatests.sh} Deleted obsolete CI, configuration, license, and documentation files.
tools/pika_migrate/CMakeLists.txt Enhanced build configuration for pika-migrate with project setup, protobuf generation, and dependency linking.
tools/pika_migrate/conf/pika.conf Extended configuration with new parameters, updated port (9221), and added performance tuning options.
tools/pika_migrate/src/build_version.cc.in Updated build version metadata placeholders (git SHA and compile date) to new format.
tools/pika_migrate/pika-migrate.md Added detailed documentation for the Pika 4.0 → Redis migration tool, outlining functionality, configuration, and process steps.
tools/pika_migrate/protogen.cmake Introduced the CUSTOM_PROTOBUF_GENERATE_CPP function for auto-generating C++ sources from .proto files.
tools/pika_migrate/include/* Added/updated numerous header files (ACL, migrator, admin, client, consensus, DB, configuration, commands for KV, list, set, zset, pubsub, transaction, stream, statistics, etc.), including migration from pink to net libraries and flag type modifications.
tools/pika_migrate/(repl*, rsync*, slave*, slot*, dispatch*, monitor*, sender., server., throttle.h) Introduced new components for replication, synchronization, migration, rsync-based file transfers, and throttling; refactored connection and thread management to use the net and pstd libraries.
tools/pika_migrate/include/pika_define.h Added new structures (DBStruct, LogicOffset, LogOffset, DBInfo) and constants for enhanced database and cache configuration.
tools/pika_migrate/src/acl.cc Implemented a new ACL system with updated user, selector, and permission management.
tools/pika_migrate/include/pika_version.h Updated version constants from 3.2.7 to 4.0.0.

Sequence Diagram(s)

sequenceDiagram
    participant M as Migration Tool
    participant P as Primary Pika
    participant R as Redis
    M->>P: Request full DB and current binlog position
    P-->>M: Send full database data and binlog position
    M->>R: Forward full data & initialize migration
    M->>P: Request incremental updates using binlog position
    P-->>M: Return binlog entries
    M->>R: Convert and send Redis commands for incremental sync

Poem

Hopping through the lines of code so bright,
I see new features bloom in digital light.
With ACLs, threads, and migration so keen,
The old is shed, the new reigns supreme.
I, a jolly rabbit, cheer with pure delight—
For Pika 4.0 dances into the night!

✨ Finishing Touches
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jan 03 '25 11:01 coderabbitai[bot]

感觉tools下代码太多了,net,pstd这些可以感觉可以直接用pika下的。然后cache这些其实作为migrate工具来说也不需要。

wangshao1 avatar Jan 17 '25 07:01 wangshao1

Bot detected the issue body's language is not English, translate it automatically.


I feel that there are too many codes under tools. I feel like net and pstd can be directly downloaded using pika. And cache is actually not needed as a migrate tool.

Issues-translate-bot avatar Jan 17 '25 07:01 Issues-translate-bot

感觉tools下代码太多了,net,pstd这些可以感觉可以直接用pika下的。然后cache这些其实作为migrate工具来说也不需要。

done,简化了一下,把net、storage、pstd和cache全删了,直接使用主目录下的 @wangshao1

pro-spild avatar Feb 12 '25 02:02 pro-spild

Bot detected the issue body's language is not English, translate it automatically.


I feel that there are too many codes under tools, net, pstd, etc. can be directly used to use pika. Then cache is not needed as migrate tools.

done, simplified it, deleted all net, storage, pstd and cache, and directly use the

Issues-translate-bot avatar Feb 12 '25 02:02 Issues-translate-bot

建立新的分支 将这个工具的代码放在这个分支 编译成功后把二进制塞进发布包中,不要把所有的代码放到主干分支

chejinge avatar Aug 28 '25 06:08 chejinge

Bot detected the issue body's language is not English, translate it automatically.


Create a new branch Place the code of this tool in this branch After the compilation is successful, stuff the binary into the publishing package, do not put all the code in the trunk branch

Issues-translate-bot avatar Aug 28 '25 06:08 Issues-translate-bot