coreos / torus

Torus Distributed Storage
https://coreos.com/blog/torus-distributed-storage-by-coreos.html
Apache License 2.0
1.78k stars 172 forks source link

mod ring causes panic when it doesn't have enough storage node #427

Closed nak3 closed 7 years ago

nak3 commented 7 years ago

version

steps to reproduce

1. Setup ring type mod.

$ ./bin/torusctl init
$ ./bin/torusctl ring manual-change --type=mod
$ ./bin/torusctl ring get
Ring: Mod
Replication:2
Peers:

2. Run only 1 peer

$ ./bin/torusd --peer-address=http://127.0.0.1:4000 --auto-join --size=10GiB

3. Create test volume and attach it to nbd

$ ./bin/torusctl volume create-block testVol 1GiB
$ sudo ./bin/torusblk nbd testVol

4. Write to the volume (e.g mkfs)

# mkfs.ext4 /dev/nbd0

actual result

goroutine 99 [running]: panic(0xa01680, 0xc420010180) /usr/local/go/src/runtime/panic.go:500 +0x1a1 github.com/coreos/torus/distributor.(Distributor).GetBlock(0xc42030e6c0, 0x7f31b7c74fe8, 0xc4203e2540, 0x10000000002, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, ...) /home/knakayam/.go/src/github.com/coreos/torus/distributor/storage.go:37 +0x953 github.com/coreos/torus.(INodeStore).GetINode(0xc42013b7a0, 0x7f31b7c74fe8, 0xc4203e2540, 0x2, 0x5, 0x1, 0xc4203c0860, 0x0) /home/knakayam/.go/src/github.com/coreos/torus/inode.go:94 +0x11c github.com/coreos/torus/block.(blockvolGC).PrepVolume(0xc420317780, 0xc4203d3bc0, 0x0, 0x0) /home/knakayam/.go/src/github.com/coreos/torus/block/gc_block_vol.go:70 +0x3fc github.com/coreos/torus/gc.(controller).PrepVolume(0xc42013b7c0, 0xc4203d3bc0, 0x0, 0x0) /home/knakayam/.go/src/github.com/coreos/torus/gc/gc.go:49 +0x5e github.com/coreos/torus/distributor/rebalance.(rebalancer).PrepVolume(0xc420158ba0, 0xc4203d3bc0, 0x2, 0x2) /home/knakayam/.go/src/github.com/coreos/torus/distributor/rebalance/rebalancer.go:59 +0x3e github.com/coreos/torus/distributor.(Distributor).rebalanceTicker(0xc42030e6c0, 0xc420158c00) /home/knakayam/.go/src/github.com/coreos/torus/distributor/rebalance.go:55 +0x147 created by github.com/coreos/torus/distributor.newDistributor /home/knakayam/.go/src/github.com/coreos/torus/distributor/distributor.go:69 +0x540