Revert the option regardless of error

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
pull/14525/head
Oleg Zaytsev 2024-07-30 11:31:31 +02:00
parent d8e1b6bdfd
commit 0300ad58a9
No known key found for this signature in database
GPG Key ID: 7E9FE9FD48F512EF
1 changed files with 1 additions and 1 deletions

View File

@ -630,8 +630,8 @@ func (h *Head) Init(minValidTime int64) (err error) {
if h.opts.EnableSharding {
h.opts.EnableSharding = false
defer func() {
h.opts.EnableSharding = true
if err == nil {
h.opts.EnableSharding = true
// No locking is needed here as nobody should be writing while we're in Init.
for _, stripe := range h.series.series {
for _, s := range stripe {