Skip to content

4.x: Unify throttler permit release across request handlers #1228

Open

Description

@nikagra

Problem

Every request handler returns its throttler permit "exactly once", but each one does it differently:

  • CqlRequestHandler: an admitted flag, a registrationComplete flag, a throttlerReleased CAS, and a saved terminalError
  • GraphRequestHandler and CqlPrepareHandler: whichever completeExceptionally wins, a CancellationException carve-out, and the exceptionally hook
  • ThrottledAdminRequestHandler: the admitted flag only
  • ContinuousRequestHandlerBase: the return value of abortGlobalRequestOrChosenCallback and the cancel listener

After #1007 the handlers already behave differently. Only CqlRequestHandler defers a release when a timeout races register(), and only it returns early from onThrottleReady() when the result is already complete. GraphRequestHandler and CqlPrepareHandler still record THROTTLING_DELAY and build a query plan for a request that timed out or was cancelled while its ready callback was pending. That is harmless today only because sendRequest() checks result.isDone().

Every review round of #1007 found the same defect again in a sibling handler.

Expected behavior

One small shared helper handles the permit for every handler: it marks the request admitted, releases the permit once, and chooses signalTimeout, signalCancel or signalError from the result's state. Every handler uses it, so #949, #1013 and #1014 build on one tested mechanism.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions