abhishekrb19 opened a new pull request, #18025:
URL: https://github.com/apache/druid/pull/18025

   When a segment is missing or corrupt such that it cannot be loaded on a 
historical, queries that touch the segment return partial results (despite the 
default behavior of `returnPartialResults: true`).
   
   Previously, the response context header was written eagerly in 
`initialize()` and skipped in `flush()`. However query runners may still add 
entries to the response context after initialization. This issue specifically 
occurs when the missing segment is at the end of the timeline. In such cases, 
`ReportTimelineMissingSegmentQueryRunner` sets the response context, but it's 
not propagated in the actual response because of the short-circuit we have, 
particularly in `flush()`.
   
   Fix:
   - This patch ensures that the response context is also serialized in 
`flush()` at the end once everything is accumulated. The serialization logic 
has been moved to a helper method `writeResponseContextHeader()`, which is 
called from both `initialize()` and `flush()` as needed.
   - Added a unit test that fails without this patch
   - Exploring how straightforward it would be to add an integration test
   
   
   This PR has:
   
   - [x] been self-reviewed.
   - [ ] a release note entry in the PR description.
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [x] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to