Skip to content

[Pipe] Back off TsFile parser admission retries#18262

Open
Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix/pipe-parser-admission-backoff
Open

[Pipe] Back off TsFile parser admission retries#18262
Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix/pipe-parser-admission-backoff

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

TsFile parser admission currently retries with a fixed sleep when Pipe memory is exhausted. Concurrent parser requests can therefore wake in lockstep, and a request may keep sleeping even after another parser releases its reservation.

This PR changes parser admission retries to:

  • use bounded exponential backoff starting from pipe_check_memory_enough_interval_ms;
  • cap the interval at the initial interval multiplied by pipe_memory_allocate_max_retries;
  • add 50%-100% jitter to avoid synchronized retries;
  • wait on PipeMemoryManager so parser and Pipe memory releases wake admission attempts immediately;
  • preserve the existing overall parser admission timeout.

This is independent of receiver/sink backoff in #18236, which does not cover parser admission. Fair scheduling across Pipes remains isolated in #18260.

Tests

  • Verify exponential growth, overflow-safe capping, and jitter bounds.
  • Exhaust parser memory with a real TsFile parser request, configure a 10-second retry interval, release one reservation, and verify the parser is notified and admitted within 3 seconds.

This PR has:

  • been self-reviewed.
    • concurrent read and write
  • added unit tests for parser admission backoff and release notification.

Key changed/added classes
  • PipeTsFileInsertionEvent
  • PipeMemoryManager
  • PipeTsFileInsertionEventAdmissionTest

Comment on lines +934 to +939
static long getMaxMemoryCheckIntervalMs(final long initialIntervalMs, final int maxRetries) {
final long multiplier = Math.max(1, maxRetries);
return initialIntervalMs > Long.MAX_VALUE / multiplier
? Long.MAX_VALUE
: initialIntervalMs * multiplier;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the semantic of the maxRetries has changed, you should supplement some description in the config.

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.

2 participants