./target/debug/tikv-ctl ldb scan --db=./db/ --column_family=raft --key_hex
[2022/11/02 11:09:02.218 +08:00] [INFO] [mod.rs:118] ["encryption: none of key dictionary and file dictionary are found."]
[2022/11/02 11:09:02.218 +08:00] [INFO] [mod.rs:479] ["encryption is disabled."]
0x0102000000000000000203 :I I( D
// raft regionid applysurffix
0x0103000000000000000201 :5*
// meta regionid raftsurffix
这是rocksdb-kv中存的region2 的数据后一行是region的meta信息。入口是这里,删掉就是删掉了region
其中regionid是大端写入的从bit【2-10】
./target/debug/tikv-ctl ldb scan --db=./raft/ --column_family=default --key_hex --value_hex
[2022/11/02 11:20:25.103 +08:00] [INFO] [mod.rs:118] ["encryption: none of key dictionary and file dictionary are found."]
[2022/11/02 11:20:25.103 +08:00] [INFO] [mod.rs:479] ["encryption is disabled."]
0x01020000000000000002010000000000000045 : 0x08011009184522261002181822200A0E08021204080510042A04083110011A0E0801120A08021206081810011801320101
0x01020000000000000002010000000000000046 : 0x1009184622140A0808021204080510041A080803220408441009
0x01020000000000000002010000000000000047 : 0x08011009184722201818221C0A0E08021204080510042A04083210011A0A08011206120408181001320101
0x01020000000000000002010000000000000048 : 0x080110091848222410011818221E0A0E08021204080510042A04083310011A0C080112080801120408181001320101
0x01020000000000000002010000000000000049 : 0x08011009184922261002181922200A0E08021204080510042A04083410011A0E0801120A08021206081910011801320101
0x0102000000000000000202 : 0x0A060809100518481049
rocksdb-raft 中的 default cf中的数据,最后一行就是 region 2 在raft中记录的状态
删掉 rocksdb-kv 中 0x0103000000000000000201 这个key就相当于 region 2 删了,其他的如果报错就清理下。
[tidb-develop-zgc tikv]# ./target/debug/tikv-ctl ldb delete 0x0103000000000000000201 --db=./db/ --column_family=raft --key_hex
[2022/11/02 11:25:00.464 +08:00] [INFO] [mod.rs:118] ["encryption: none of key dictionary and file dictionary are found."]
[2022/11/02 11:25:00.465 +08:00] [INFO] [mod.rs:479] ["encryption is disabled."]
OK
[tidb-develop-zgc tikv]# ./target/debug/tikv-ctl ldb scan --db=./db/ --column_family=raft --key_hex
[2022/11/02 11:25:08.888 +08:00] [INFO] [mod.rs:118] ["encryption: none of key dictionary and file dictionary are found."]
[2022/11/02 11:25:08.888 +08:00] [INFO] [mod.rs:479] ["encryption is disabled."]
0x0102000000000000000203 :I I( D
tikv起来以后,region count是0了。
pd那里还能看到region信息,那是因为另一个节点没启动,启动的话上报一下心跳,这个reigon的peer就消失了。
纯试验,出错不负责