kvrocks icon indicating copy to clipboard operation
kvrocks copied to clipboard

Refactor the data migration code

Open caipengbo opened this issue 1 year ago • 6 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Motivation

Now that we have support for DBIterator and WALIterator, we can refactor migration code based on redis-command using these two classes. Also, now that we support two different migration types, we can make the code base about migration a bit cleaner than it is now.

The unit tests could also be clearer.

Solution

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

caipengbo avatar Jan 31 '24 11:01 caipengbo

Hi, i'm interested in this issue, could you please assign this to me?

wsehjk avatar Feb 17 '24 05:02 wsehjk

@wsehjk Assigned. Go ahead :D

Based on my experience, you can share your opinion on this issue and how you'd like to implement it. If it's trivial, directly sending a patch is good.

Barely asking for an assignment without any thoughts or progress attempts often ends with giving up.

tisonkun avatar Feb 17 '24 06:02 tisonkun

@caipengbo Would you mind giving some input about what you plan to improve?

git-hulk avatar Feb 17 '24 09:02 git-hulk

@git-hulk This is my personal opinion for reference only:

  1. decouple the iteration logic from the send logic:
    • use DBIterator and WALIterator for data iteration
    • use a Sender helper class for sending data and rate limit
  2. Make the two migration types more uniform
  3. Refactor Golang unit tests about data migration to make them more concise and faster to run
  4. Other minor change:
    • MigrationJob stores what is really needed
    • ...

As @tisonkun said, you can also share some of your plans and we can discuss them together @wsehjk .

caipengbo avatar Feb 17 '24 09:02 caipengbo

@caipengbo Thanks for your input.

git-hulk avatar Feb 17 '24 10:02 git-hulk

@git-hulk This is my personal opinion for reference only:

  1. decouple the iteration logic from the send logic:

    • use DBIterator and WALIterator for data iteration
    • use a Sender helper class for sending data and rate limit
  2. Make the two migration types more uniform

  3. Refactor Golang unit tests about data migration to make them more concise and faster to run

  4. Other minor change:

    • MigrationJob stores what is really needed
    • ...

As @tisonkun said, you can also share some of your plans and we can discuss them together @wsehjk .

Thank you for the info, really helpful, and i will walk through the code and share my thought before developing

wsehjk avatar Feb 17 '24 16:02 wsehjk