tinykv 启动失败:panic: runtime error: invalid memory address or nil pointer dereference

环境:vmare +centos9
配置:3G
步骤:
git clone https://github.com/tidb-incubator/tinykv.git
cd tinykv
make
启动:
./tinykv-server -path=data

错误日志:

[root@localhost bin]# ./tinykv-server -path=data
2021/11/22 17:02:55.701438 main.go:49: [info] Server started with conf &{StoreAddr:127.0.0.1:20160 Raft:true SchedulerAddr:127.0.0.1:2379 LogLevel:info DBPath:data RaftBaseTickInterval:1s RaftHeartbeatTicks:2 RaftElectionTimeoutTicks:10 RaftLogGCTickInterval:10s RaftLogGcCountLimit:128000 SplitRegionCheckTickInterval:10s SchedulerHeartbeatTickInterval:100ms SchedulerStoreHeartbeatTickInterval:10s RegionMaxSize:150994944 RegionSplitSize:100663296}
2021/11/22 17:02:55.723928 client.go:96: [info] [][scheduler] create scheduler client with endpoints [http://127.0.0.1:2379]
2021/11/22 17:02:55.733437 client.go:203: [info] [scheduler] switch leader, new-leader: http://127.0.0.1:2379, old-leader:
2021/11/22 17:02:55.733477 client.go:124: [info] [][scheduler] init cluster id 7033311790700247754
[2021/11/22 17:02:55.736 +08:00] [INFO] [grpc_service.go:222] [“put store ok”] [store="id:1 address:“127.0.0.1:20160” "]
2021/11/22 17:02:55.736696 node.go:193: [info] start raft store node, storeID: 1
2021/11/22 17:02:55.737376 peer.go:41: [info] region id:2 region_epoch:<conf_ver:1 version:1 > peers:<id:3 store_id:1 > create peer with ID 3
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xcc3e89]

goroutine 1 [running]:
github.com/pingcap-incubator/tinykv/raft.(*RawNode).Campaign(…)
/root/go/src/tinykv/raft/rawnode.go:88
github.com/pingcap-incubator/tinykv/kv/raftstore.NewPeer(0x1, 0xc0003400a0, 0xc00013e270, 0xc0000ce200, 0xc000226f60, 0xc000163470, 0x2, 0x30, 0xc000163410)
/root/go/src/tinykv/kv/raftstore/peer.go:153 +0x429
github.com/pingcap-incubator/tinykv/kv/raftstore.createPeer(0x1, 0xc0003400a0, 0xc000226f60, 0xc00013e270, 0xc0000ce200, 0x0, 0x0, 0x0)

course分支下面还没做完,还不能跑吧

应该是Campaign函数没有实现,直接返回nil导致的panic,需要实现后再运行

1赞

我的问题,我以为默认就可以直接用呢

too young to simple

做完了再跑吧。。。

收到。新手 继续学习,感谢