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: makes AppendExtentKeyWithCheck request idempotent #1224

Conversation

shuoranliu
Copy link
Member

@shuoranliu shuoranliu commented Sep 14, 2021

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.

-> client send AppendExtentKeyWithCheck to metanode (offset: 0,

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:

@shuoranliu shuoranliu force-pushed the fix-conflict-extents-error-due-to-client-retry branch 2 times, most recently from 3f49444 to 21974b5 Compare September 15, 2021 03:34
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.

    -> client send AppendExtentKeyWithCheck to metanode (offset: 0,
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>
@shuoranliu shuoranliu force-pushed the fix-conflict-extents-error-due-to-client-retry branch from 21974b5 to 2fe9551 Compare September 15, 2021 04:17
@shuoranliu shuoranliu merged commit 9e10f9c into cubefs:master Sep 15, 2021
@shuoranliu shuoranliu deleted the fix-conflict-extents-error-due-to-client-retry branch September 24, 2021 07:54
awzhgw pushed a commit that referenced this pull request Jan 10, 2024
…-05 18:01:34

修复data node单测编译失败问题
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.

None yet

2 participants