Skip to content

client/resource_group: settle reported write consumption at response time #10985

Description

@YuhaoZhang00

Problem

Write RU is knowable before a KV RPC, so OnRequestWait reserves the full write cost in the local limiter before sending the request. The same reservation is currently also added to cumulative reported consumption at request time, before the response is available. This couples local token reservation with settled consumption, places successful WRU in the request-side reporting interval, and lets an existing failed-write payback cross a periodic reporting boundary that only accepts positive monotonic deltas.

This timing problem was identified while reviewing #10611: #10611 (comment)

Expected behavior

Keep the full request-time token reservation for admission control, but exclude the write reservation from reported consumption until the response settles. At response time, add the write reservation and the existing response delta together. Successful writes then report the full reservation at settlement, while any existing response-side payback is applied in the same reporting delta instead of trying to correct an earlier report.

Scope

This issue covers controller-side reporting timing and settlement only. It does not change how client-go determines ResponseInfo.Succeed(), and it does not define settlement for requests that return no response.

Version

Current master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.contributionThis PR is from a community contributor.severity/moderatetype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions