Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support slot batch for CLUSTERX SETSLOT #1414

Merged
merged 2 commits into from
May 14, 2023

Conversation

infdahai
Copy link
Contributor

@infdahai infdahai commented May 1, 2023

closes #1412. refer to #529

  1. add stdint.h for uint_t type
    ref(https://godbolt.org/z/5q6zj5W9s)
  2. add cluster_setslot_batch feature.
  3. tests for parsedSlotRange(cpp unit and go test)
  4. move parse func to commandX

src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/commands/cmd_cluster.cc Outdated Show resolved Hide resolved
@infdahai infdahai changed the title support for cluster slot batch support for slot batch for CLUSTERX SETSLOT May 2, 2023
@infdahai infdahai changed the title support for slot batch for CLUSTERX SETSLOT support slot batch for CLUSTERX SETSLOT May 2, 2023
@infdahai infdahai force-pushed the cluster_slot_batch branch from ac3e381 to 2a340e6 Compare May 2, 2023 01:39
Copy link
Member

@PragmaTwice PragmaTwice left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

You can run ./x.py format to format the code and let the CI proceed.

src/common/encoding.h Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
x.py Outdated Show resolved Hide resolved
src/cluster/redis_slot.h Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
@infdahai

This comment was marked as off-topic.

@PragmaTwice
Copy link
Member

PragmaTwice commented May 2, 2023

If I exec ./x.py format, I get a irrelevant result.(Not important though, just ignored). image

Could you provide the version of clang-format you are using?

Anyway, I think you can firstly manually ignore this unrelated change as a workaround.

@PragmaTwice PragmaTwice closed this May 2, 2023
@PragmaTwice PragmaTwice reopened this May 2, 2023
@PragmaTwice
Copy link
Member

Sorry for the wrong close-button click. 🤣

@infdahai

This comment was marked as off-topic.

@PragmaTwice
Copy link
Member

PragmaTwice commented May 2, 2023

CI seems still blocked in format. Not sure your clang-format version, but you can try clang-format 12, which is used in CI.

https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.1

And I can confirm that clang-format 14 on my local has also no issue.

/home/runner/work/incubator-kvrocks/incubator-kvrocks/src/cluster/cluster.cc:474:39: error: code should be clang-formatted [-Wclang-format-violations]
  for (const auto &id : n->replicas) {      // replicas
                                      ^

@infdahai infdahai force-pushed the cluster_slot_batch branch from 5d48663 to 5d4cf69 Compare May 2, 2023 08:11
@infdahai
Copy link
Contributor Author

infdahai commented May 2, 2023

CI seems still blocked in format. Not sure your clang-format version, but you can try clang-format 12, which is used in CI.

https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.1

And I can confirm that clang-format 14 on my local has also no issue.

/home/runner/work/incubator-kvrocks/incubator-kvrocks/src/cluster/cluster.cc:474:39: error: code should be clang-formatted [-Wclang-format-violations]
  for (const auto &id : n->replicas) {      // replicas
                                      ^

Sorry for this problem. My llvm toolchain version is not unified and the clang-format version is 16.

You're too kind. Ignore this problem.

src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
@infdahai infdahai force-pushed the cluster_slot_batch branch 3 times, most recently from d245e9c to fa57cb7 Compare May 3, 2023 10:42
Copy link
Member

@PragmaTwice PragmaTwice left a comment

Choose a reason for hiding this comment

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

LGTM generally, it would be better if you add several golang tests to tests/gocase/integration/cluster/cluster_test.go .

src/commands/cmd_cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster.cc Outdated Show resolved Hide resolved
@infdahai infdahai force-pushed the cluster_slot_batch branch 2 times, most recently from 6f9eeab to ea4d676 Compare May 4, 2023 18:56
caipengbo
caipengbo previously approved these changes May 5, 2023
src/cluster/cluster.cc Outdated Show resolved Hide resolved
src/cluster/cluster_defs.h Show resolved Hide resolved
if (old_node == myself_ && old_node != to_assign_node) {
// If slot is migrated from this node
if (migrated_slots_.count(slot) > 0) {
svr_->slot_migrator->ClearKeysOfSlot(kDefaultNamespace, slot);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One ClearKeyOfSlot call one writebatch of rocksdb.
So this process exists consistency issues if slot in the middle is down.
I don't know what to do with it yet

Copy link
Contributor

@caipengbo caipengbo May 5, 2023

Choose a reason for hiding this comment

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

There is indeed this problem and we can persist it to Propagate CF.

Copy link
Contributor

Choose a reason for hiding this comment

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

After we merge this PR, you can ask an issue and I will solve this problem, which I have solved in production environment.

@infdahai infdahai force-pushed the cluster_slot_batch branch 2 times, most recently from 333f37b to 870afd2 Compare May 5, 2023 06:37
src/cluster/cluster.cc Outdated Show resolved Hide resolved
@git-hulk
Copy link
Member

git-hulk commented May 5, 2023

LGTM, I think we can remove TODO comments, then submit an issue if you feel it's necessary.

@infdahai
Copy link
Contributor Author

infdahai commented May 5, 2023

LGTM, I think we can remove TODO comments, then submit an issue if you feel it's necessary.

OK

@infdahai infdahai force-pushed the cluster_slot_batch branch 2 times, most recently from 8aee7e9 to e8a5bd4 Compare May 14, 2023 05:57
infdahai added 2 commits May 14, 2023 14:00
1. ref(https://godbolt.org/z/5q6zj5W9s)

Signed-off-by: clundro <859287553@qq.com>
                1. add  cluster_slot_batch ref to apache#529

                2. add tests for parsedSlotRange

                3. move parse func to commandX

Signed-off-by: clundro <859287553@qq.com>
@infdahai infdahai force-pushed the cluster_slot_batch branch from e8a5bd4 to 0ad6d85 Compare May 14, 2023 06:00
@infdahai infdahai requested a review from git-hulk May 14, 2023 07:54
Copy link
Contributor

@caipengbo caipengbo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@torwig torwig left a comment

Choose a reason for hiding this comment

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

LGTM

@git-hulk
Copy link
Member

Thanks all, merging...

@git-hulk git-hulk merged commit d2d10f7 into apache:unstable May 14, 2023
@infdahai infdahai deleted the cluster_slot_batch branch May 14, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support slot batch operation for CLUSTERX SETSLOT (REVIVED)
6 participants