fix: makes AppendExtentKeyWithCheck request idempotent #1224
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit makes AppendExtentKeyWithCheck request idempotent to avoid
conflict extents error when client retries.
For example,
-> client writes [0, 100) to extent 25,
-> send AppendExtentKeyWithCheck to metanode (offset: 0, size: 100, extentID:
25, discard extent: nil),
-> client overwrites [0, 100) to extent 30,
-> send AppendExtentKeyWithCheck to metanode (offset: 0, size:
100, extentID: 30, discard extent: 25),
Think about the following scenario: metanode managed to deal with the request,
but failed to respond to the client, and client retries with the same request.
Since AppendExtentKeyWithCheck is not idempotent, this will lead to
conflict extents error.
size: 100, extentID: 30, discard extent: 25),
-> when metanode is dealing with such request again, it expects no
discard extent, so it will respond a conflict extent error.
Reported-by: zcola zhangrui90@163.com
Signed-off-by: Shuoran Liu shuoranliu@gmail.com
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
Release note: