X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e0632f47bb83bda5badccc47cc2d8dbb70d92678..645785be096302899e754354504aaaffde4d4760:/services/keepstore/volume.go diff --git a/services/keepstore/volume.go b/services/keepstore/volume.go index 878f690c9b..c3b8cd6283 100644 --- a/services/keepstore/volume.go +++ b/services/keepstore/volume.go @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -package main +package keepstore import ( "context" @@ -371,6 +371,9 @@ func makeRRVolumeManager(logger logrus.FieldLogger, cluster *arvados.Cluster, my sort.Slice(vm.writables, func(i, j int) bool { return less(vm.writables[i], vm.writables[j]) }) + sort.Slice(vm.mounts, func(i, j int) bool { + return less(vm.mounts[i], vm.mounts[j]) + }) return vm, nil } @@ -401,6 +404,9 @@ func (vm *RRVolumeManager) AllWritable() []*VolumeMount { // each volume gets a turn to be first. Used by PutBlock to distribute // new data across available volumes. func (vm *RRVolumeManager) NextWritable() []*VolumeMount { + if len(vm.writables) == 0 { + return nil + } offset := (int(atomic.AddUint32(&vm.counter, 1)) - 1) % len(vm.writables) return append(append([]*VolumeMount(nil), vm.writables[offset:]...), vm.writables[:offset]...) }