GO-Zheng opened a new issue, #267:
URL: https://github.com/apache/kvrocks-controller/issues/267

   ### Description
   
   > The migration slot command is executed successfully when the "--slot-only" 
option is true, and fails when the option is false.
   
   ### Steps to Reproduce
   
   ```shell
   (base) root@OpsWorker [16:29:42] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # make setup
   [+] Running 4/4
    ✔ Network kvrocks-controller_default  Created    0.8s
    ✔ Container etcd0                     Started    2.0s
    ✔ Container kvrocks0                  Started    1.5s
    ✔ Container kvrocks1                  Started    2.0s
   (base) root@OpsWorker [16:30:08] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl-server -c config/config.yaml
   
{"level":"info","timestamp":"2025-02-18T16:30:12.084+0800","caller":"server/main.go:78","msg":"Kvrocks
 controller is running with version: unstable"}
   
{"level":"warn","timestamp":"2025-02-18T16:30:12.099+0800","caller":"config/config.go:94","msg":"Leader
 forward may not work if the host is 127.0.0.1"}
   
{"level":"info","timestamp":"2025-02-18T16:30:12.102+0800","caller":"server/server.go:63","msg":"Use
 Etcd as store"}
   
{"level":"info","timestamp":"2025-02-18T16:30:12.228+0800","caller":"controller/controller.go:121","msg":"Became
 the leader, resume the controller"}
   ```
   
   ```shell
   (base) root@OpsWorker [16:27:21] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl create namespace my-ns
   create namespace: my-ns successfully.
   (base) root@OpsWorker [16:30:16] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl create cluster my-cluster -n my-ns --replica 1 --nodes 
127.0.0.1:7770,127.0.0.1:7771
   create cluster: my-cluster successfully.
   (base) root@OpsWorker [16:30:22] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl get cluster my-cluster -n my-ns
   
   cluster: my-cluster
   version: 1
   
   
|-------|------------------------------------------|----------------|--------|-----------|
   | SHARD |                 NODE ID                  |    ADDRESS     |  ROLE  
| MIGRATING |
   
|-------|------------------------------------------|----------------|--------|-----------|
   |     0 | B4ZvXGc3dhpnQyP4eQ0aoFqdBNZcBdRHEomTtgxi | 127.0.0.1:7770 | MASTER 
| NO        |
   |     1 | u1kihm9JXEX130DMRCLvxXNKUKbnGYYtf7U9qIvu | 127.0.0.1:7771 | MASTER 
| NO        |
   
|-------|------------------------------------------|----------------|--------|-----------|
   (base) root@OpsWorker [16:30:31] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # redis-cli -c -h 127.0.0.1 -p 7770 cluster nodes
   u1kihm9JXEX130DMRCLvxXNKUKbnGYYtf7U9qIvu 127.0.0.1:7771@17771 master - 
1739867433566 1739867433567 1 connected 8192-16383
   B4ZvXGc3dhpnQyP4eQ0aoFqdBNZcBdRHEomTtgxi 127.0.0.1:7770@17770 myself,master 
- 1739867433566 1739867433567 1 connected 0-8191
   (base) root@OpsWorker [16:30:33] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # redis-cli -c -h 127.0.0.1 -p 7770 cluster slots
   1) 1) (integer) 0
      1) (integer) 8191
      2) 1) "127.0.0.1"
         1) (integer) 7770
         2) "B4ZvXGc3dhpnQyP4eQ0aoFqdBNZcBdRHEomTtgxi"
   2) 1) (integer) 8192
      3) (integer) 16383
      4) 1) "127.0.0.1"
         3) (integer) 7771
         4) "u1kihm9JXEX130DMRCLvxXNKUKbnGYYtf7U9qIvu"
   (base) root@OpsWorker [16:30:37] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl migrate slot 100 -n my-ns -c my-cluster --slot-only 
false --target 1
   migrate slot[100] task is submitted successfully.
   ```
   
   > View the results after executing the migration command.
   > The cluster has not changed.
   > Controller found error log.
   
   ```shell
   (base) root@OpsWorker [16:30:08] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl-server -c config/config.yaml
   
{"level":"info","timestamp":"2025-02-18T16:30:12.084+0800","caller":"server/main.go:78","msg":"Kvrocks
 controller is running with version: unstable"}
   
{"level":"warn","timestamp":"2025-02-18T16:30:12.099+0800","caller":"config/config.go:94","msg":"Leader
 forward may not work if the host is 127.0.0.1"}
   
{"level":"info","timestamp":"2025-02-18T16:30:12.102+0800","caller":"server/server.go:63","msg":"Use
 Etcd as store"}
   
{"level":"info","timestamp":"2025-02-18T16:30:12.228+0800","caller":"controller/controller.go:121","msg":"Became
 the leader, resume the controller"}
   
{"level":"error","timestamp":"2025-02-18T16:31:05.063+0800","caller":"controller/cluster.go:291","msg":"Mismatch
 migrate 
slot","namespace":"my-ns","cluster":"my-cluster","slot":100,"stacktrace":"github.com/apache/kvrocks-controller/controller.(*ClusterChecker).tryUpdateMigrationStatus\n\t/root/code/github/kvrocks-controller/controller/cluster.go:291\ngithub.com/apache/kvrocks-controller/controller.(*ClusterChecker).migrationLoop\n\t/root/code/github/kvrocks-controller/controller/cluster.go:353"}
   
{"level":"error","timestamp":"2025-02-18T16:31:06.063+0800","caller":"controller/cluster.go:291","msg":"Mismatch
 migrate 
slot","namespace":"my-ns","cluster":"my-cluster","slot":100,"stacktrace":"github.com/apache/kvrocks-controller/controller.(*ClusterChecker).tryUpdateMigrationStatus\n\t/root/code/github/kvrocks-controller/controller/cluster.go:291\ngithub.com/apache/kvrocks-controller/controller.(*ClusterChecker).migrationLoop\n\t/root/code/github/kvrocks-controller/controller/cluster.go:353"}
   
{"level":"error","timestamp":"2025-02-18T16:31:07.063+0800","caller":"controller/cluster.go:291","msg":"Mismatch
 migrate 
slot","namespace":"my-ns","cluster":"my-cluster","slot":100,"stacktrace":"github.com/apache/kvrocks-controller/controller.(*ClusterChecker).tryUpdateMigrationStatus\n\t/root/code/github/kvrocks-controller/controller/cluster.go:291\ngithub.com/apache/kvrocks-controller/controller.(*ClusterChecker).migrationLoop\n\t/root/code/github/kvrocks-controller/controller/cluster.go:353"}
   ```
   
   ```shell
   (base) root@OpsWorker [16:30:37] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl migrate slot 100 -n my-ns -c my-cluster --slot-only 
false --target 1
   migrate slot[100] task is submitted successfully.
   (base) root@OpsWorker [16:30:58] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # ./_build/kvctl get cluster my-cluster -n my-ns
   
   cluster: my-cluster
   version: 1
   
   
|-------|------------------------------------------|----------------|--------|-----------|
   | SHARD |                 NODE ID                  |    ADDRESS     |  ROLE  
| MIGRATING |
   
|-------|------------------------------------------|----------------|--------|-----------|
   |     0 | B4ZvXGc3dhpnQyP4eQ0aoFqdBNZcBdRHEomTtgxi | 127.0.0.1:7770 | MASTER 
| 100 --> 1 |
   |     1 | u1kihm9JXEX130DMRCLvxXNKUKbnGYYtf7U9qIvu | 127.0.0.1:7771 | MASTER 
| NO        |
   
|-------|------------------------------------------|----------------|--------|-----------|
   (base) root@OpsWorker [16:31:41] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # redis-cli -c -h 127.0.0.1 -p 7770 cluster nodes
   u1kihm9JXEX130DMRCLvxXNKUKbnGYYtf7U9qIvu 127.0.0.1:7771@17771 master - 
1739867506699 1739867506700 1 connected 8192-16383
   B4ZvXGc3dhpnQyP4eQ0aoFqdBNZcBdRHEomTtgxi 127.0.0.1:7770@17770 myself,master 
- 1739867506699 1739867506700 1 connected 0-8191
   (base) root@OpsWorker [16:31:46] [~/code/github/kvrocks-controller] 
[unstable *]
   -> # redis-cli -c -h 127.0.0.1 -p 7770 cluster slots
   1) 1) (integer) 0
      1) (integer) 8191
      2) 1) "127.0.0.1"
         1) (integer) 7770
         2) "B4ZvXGc3dhpnQyP4eQ0aoFqdBNZcBdRHEomTtgxi"
   2) 1) (integer) 8192
      3) (integer) 16383
      4) 1) "127.0.0.1"
         3) (integer) 7771
         4) "u1kihm9JXEX130DMRCLvxXNKUKbnGYYtf7U9qIvu"
   ```
   ### Environment
   
   ```shell
   # system
   WSL2 - Ubuntu 24.04.1 LTS
   
   # controller
   The latest "unstable" branch
   
   # docker images
   REPOSITORY            TAG       IMAGE ID       CREATED        SIZE
   apache/kvrocks        2.11.0    9140d7b357fc   3 weeks ago    156MB
   quay.io/coreos/etcd   v3.5.17   0b844ea0bc6b   3 months ago   59MB
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to