Skip to content

fix: signal DataTable deserialization errors immediately instead of waiting for timeout (#18866) - #19172

Open
waterWang wants to merge 5 commits into
apache:masterfrom
waterWang:fix/data-table-deserialization-error-18866
Open

fix: signal DataTable deserialization errors immediately instead of waiting for timeout (#18866)#19172
waterWang wants to merge 5 commits into
apache:masterfrom
waterWang:fix/data-table-deserialization-error-18866

Conversation

@waterWang

Copy link
Copy Markdown

Fixes #18866

Problem

When a Pinot server sends back a response that the broker cannot deserialize into a DataTable, the DataTableHandler catch block only logs the error and bumps a metric — it never signals the query. The query then blocks until the full broker timeout expires and returns a misleading BROKER_TIMEOUT with partial results.

Side effects (beyond the timeout):

  • Failure detector is not notified, so the bad server keeps receiving queries
  • Routing stats charge the full timeout as latency for the bad server
  • Generic timeout metric hides the real cause

Fix

  1. QueryErrorCode.java: Add DATA_TABLE_DESERIALIZATION_ERROR(426) to distinguish deserialization failures from generic internal errors and timeouts.

  2. AsyncQueryResponse.java: Add receiveDataTableDeserializationError() — counts down the latch for this server only (without failing the entire query), records the failed server, and sets the exception. This allows the query to complete with partial results from the remaining healthy servers.

  3. QueryRouter.java: Add receiveDataTableDeserializationError() — iterates over in-flight queries and marks any still waiting on this server.

  4. DataTableHandler.java: In the catch block, call _queryRouter.receiveDataTableDeserializationError() instead of silently logging.

  5. QueryRoutingTest.java: Add testDataTableDeserializationError() — sends garbage bytes as the server response and verifies the query completes in under 1 second instead of waiting for the 10-second timeout.

Testing

  • New test: testDataTableDeserializationError() — sends new byte[]{0,1,2,3,4,5} as server response, verifies query completes in < 1s (not 10s timeout)
  • Existing tests unchanged

@Jackie-Jiang Jackie-Jiang added bug Something is not working as expected query Related to query processing labels Aug 6, 2026

@Jackie-Jiang Jackie-Jiang left a comment

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.

Nice fix. The only thing we need to discuss is should we count this as failed server, or treat it as regular exception

/// query can complete with partial results from the remaining servers instead of waiting for the full timeout.
void receiveDataTableDeserializationError(ServerRoutingInstance serverRoutingInstance) {
ServerResponse response = _responseMap.get(serverRoutingInstance);
if (response != null && response.getDataTable() == null) {

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.

Could this every be null or having a data table?

Should we count this as a failed server, or form a DataTable wrapping the exception and reuse receiveDataTable() flow

/// Error deserializing a DataTable response from a server. The server sent back bytes that the broker could not
/// deserialize, so the query will complete with partial results from the other servers instead of waiting for the
/// full timeout.
DATA_TABLE_DESERIALIZATION_ERROR(426, "DataTableDeserializationError", Response.Status.INTERNAL_SERVER_ERROR),

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.

(minor) Insert it in the right position

@Jackie-Jiang
Jackie-Jiang requested a lite review from Copilot August 6, 2026 21:30

Copilot AI left a comment

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

bug Something is not working as expected query Related to query processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broker silently masks DataTable deserialization failures as query timeouts

3 participants