Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heal: Persist MRF queue in the disk during shutdown #19410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vadmeste
Copy link
Member

@vadmeste vadmeste commented Apr 4, 2024

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

Motivation and Context

How to test this PR?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

@vadmeste vadmeste marked this pull request as ready for review April 8, 2024 10:13
cmd/mrf.go Outdated Show resolved Hide resolved
cmd/erasure-server-pool.go Outdated Show resolved Hide resolved
cmd/erasure-server-pool.go Outdated Show resolved Hide resolved
cmd/erasure-server-pool.go Outdated Show resolved Hide resolved
cmd/signals.go Outdated Show resolved Hide resolved
cmd/mrf.go Show resolved Hide resolved
@harshavardhana
Copy link
Member

Looks reordering caused some issue in healing tests PTAL @vadmeste

@harshavardhana
Copy link
Member

@vadmeste please rebase this PR with master.

@bh4t
Copy link
Contributor

bh4t commented May 13, 2024

@vadmeste PTAL when you get a chance.

@vadmeste vadmeste force-pushed the persist-heal-mrf branch 2 times, most recently from 69b5a57 to 034b199 Compare May 20, 2024 13:05
cmd/mrf.go Outdated Show resolved Hide resolved
if m == nil {
return
}

select {
case <-m.closing:
Copy link
Member

@krisis krisis May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This select statement doesn't guarantee that this method won't send op over m.opCh. This is because once mrfState.shutdown() is called, both case <-m.closing and case m.opCh <-op may be ready and select statement picks one among them at random.

A select blocks until one of its cases can run, then it executes that case. It chooses one at random if multiple are ready.
ref: https://go.dev/tour/concurrency/5

Instead we should do like this,

select {
case <-m.closing:
      m.closeOnce.Do(func() {close(m.opCh))}
default:
      select {
      case m.opCh <- op:
      default:
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants