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

fix(storagenode): fix error-prone state management of SyncInit and Report #161

Merged
merged 1 commit into from
Sep 26, 2022

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Sep 23, 2022

What this PR does

When a log stream replica handles SyncInit, it can be prone to mutate the replica's state too early.
It should change the state after checking a valid sync range. It also updates the version, high
watermark, and uncommittedLLSNBegin with zeros to denote that the replica sends an invalid report
while the learning phase.
The replica checks whether it is in the learning phase at the end of method
internal/storagenode/logstream.(*Executor).Report to minimize the probability of concurrency
issues mentioned in #159.

Anything else

Refs

…port

When a log stream replica handles SyncInit, it can be prone to mutate the replica's state too early.
It should change the state after checking a valid sync range. It also updates the version, high
watermark, and uncommittedLLSNBegin with zeros to denote that the replica sends an invalid report
while the learning phase.
The replica checks whether it is in the learning phase at the end of method
`internal/storagenode/logstream.(*Executor).Report` to minimize the probability of concurrency
issues mentioned in kakao#159.

Refs
- kakao#159 (comment)
@ijsong ijsong requested a review from hungryjang as a code owner September 23, 2022 06:41
@codecov-commenter
Copy link

Codecov Report

Base: 62.85% // Head: 62.99% // Increases project coverage by +0.14% 🎉

Coverage data is based on head (c7366c5) compared to base (0a14ab5).
Patch coverage: 56.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #161      +/-   ##
==========================================
+ Coverage   62.85%   62.99%   +0.14%     
==========================================
  Files         126      126              
  Lines       17061    17064       +3     
==========================================
+ Hits        10723    10749      +26     
+ Misses       5781     5760      -21     
+ Partials      557      555       -2     
Impacted Files Coverage Δ
internal/storagenode/logstream/executor.go 81.21% <25.00%> (+1.71%) ⬆️
internal/storagenode/logstream/sync.go 60.38% <61.90%> (+0.22%) ⬆️
internal/metarepos/report_collector.go 77.86% <0.00%> (-0.41%) ⬇️
internal/metarepos/storage.go 80.04% <0.00%> (+0.38%) ⬆️
internal/metarepos/raft.go 80.41% <0.00%> (+0.41%) ⬆️
...metarepos/dummy_storagenode_client_factory_impl.go 63.88% <0.00%> (+1.38%) ⬆️
internal/storagenode/replication_server.go 83.00% <0.00%> (+6.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ijsong ijsong self-assigned this Sep 23, 2022
Copy link
Member

@hungryjang hungryjang left a comment

Choose a reason for hiding this comment

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

We have to pay attention to the order of storing and loading state of excutor and commit information.

@ijsong ijsong merged commit 51faf0d into kakao:main Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants