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

Use an atomic counter for datastore reads in Check #1477

Open
1 task done
miparnisari opened this issue Mar 20, 2024 · 0 comments
Open
1 task done

Use an atomic counter for datastore reads in Check #1477

miparnisari opened this issue Mar 20, 2024 · 0 comments
Labels
refactor A cleanup is needed

Comments

@miparnisari
Copy link
Member

Checklist

Describe the problem you'd like to have solved

Original discussion: #1452 (comment)

The code that calculates how many database reads were accrued in Check is hard to follow and is error-prone.

Describe the ideal solution

The proposed solution is to use an atomic.uint32 counter for the datastore_query_count, similar to dispatch_counter (

DispatchCounter *atomic.Uint32
)

Pros:

  • more readable code

Cons:

  • we are introducing a mutex, which introduces slight delays in the API
  • goes against the future idea of introducing remote peer dispatching, because we can't share an atomic counter across nodes.

Alternatives and current workarounds

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor A cleanup is needed
Projects
None yet
Development

No branches or pull requests

1 participant