Skip to content

minor: diagnostics when MSQ's on-demand segment cache can't fit an input segment - #19985

Open
cecemei wants to merge 4 commits into
apache:masterfrom
cecemei:storage
Open

minor: diagnostics when MSQ's on-demand segment cache can't fit an input segment #19985
cecemei wants to merge 4 commits into
apache:masterfrom
cecemei:storage

Conversation

@cecemei

@cecemei cecemei commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

MSQ workers read input segments through a virtual-storage cache (SegmentLocalCacheManager/StorageLocation) sized as a fraction of tmpStorageBytesPerTask. If a single segment exceeds that cache's capacity, it fails unconditionally (nothing can be evicted to make room), and the resulting error gives no numbers, just "ensure enough disk space has been allocated." The actual size/capacity data was already computed for a debug log line but never surfaced. This PR is diagnostics-only, no behavior change.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@github-actions github-actions Bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Aug 12, 2026
@cecemei
cecemei marked this pull request as ready for review August 14, 2026 19:49
Comment thread server/src/main/java/org/apache/druid/segment/loading/StorageLocation.java Outdated

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Severity Findings
P0 0
P1 0
P2 1
P3 1
Total 2

Reviewed 4 of 4 changed files.

Validation: git diff --check passed. Builds and tests not run.


This is an automated review by Codex GPT-5.6-Luna(max)

}
}
throw DruidException.forPersona(DruidException.Persona.USER)
throw DruidException.forPersona(DruidException.Persona.OPERATOR)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Capacity failure changes the error persona

Changing this exception from DruidException.Persona.USER to OPERATOR changes the response persona for the normal segment-capacity failure path. That can hide the new diagnostic from the user-facing error-response strategy and alter the wire behavior of queries that cannot fit a segment. Preserve the USER persona, or add operator diagnostics without changing the response persona.


Assertions.assertEquals(TaskState.FAILED, finalStatus.getStatusCode());
Assertions.assertTrue(
finalStatus.getErrorMsg() != null && finalStatus.getErrorMsg().contains("Unable to load segment"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P3] Capacity diagnostics are not asserted

The new test only checks the pre-existing Unable to load segment prefix, so it passes even if the size, per-location capacity, and eviction diagnostics are absent or malformed. Assert the new diagnostic values or at least the added suffix so this test protects the behavior introduced by the PR.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Severity Findings
P0 0
P1 0
P2 1
P3 0
Total 1
Severity Findings
P0 0
P1 0
P2 1
P3 0
Total 1

Reviewed 4 of 4 changed files.


This is an automated review by Codex GPT-5.6-Luna(max)

} else {
locationFailures.add(
StringUtils.format(
"location[%s]: max[%,d] available[%,d]",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Free-space failures are reported as capacity failures

When freeSpacePercent leaves insufficient physical disk space, reservation can fail even though configured available capacity is sufficient. This branch reports only max/available capacity and later claims the segment exceeded every location's capacity, misleading operators. Include the physical free-space constraint or distinguish the failure reason.

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

Labels

Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants