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

   ### Description
   
   If the packet size of a given statement exceeds the `max_allowed_packet`, an 
exception of the following form is encountered:
   
   ```
   org.skife.jdbi.v2.exceptions.CallbackFailedException:
     org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException:
     java.sql.SQLTransientConnectionException:
       (conn=10271) Could not send query: query size is >= to max_allowed_packet
   ```
   
   The root cause here is a `SQLTransientConnectionException` which gets 
(correctly) categorized as a _transient_ exception by 
`SQLMetadataConnector.isTransientException()` and is thus retried.
   
   In a typical situation where an `index_parallel` task or a Coordinator 
issued `compact` task tries to create sub-tasks with a very large payload, the 
following tends to happen:
   - Supervisor task requests the Overlord to insert the new sub-task in the DB
   - Insertion fails with violation of `max_allowed_packet`
   - Being a transient exception, the insertion is retried (typically upto 9 
times with exponential backoff, taking something like 3 mins in total)
   - While the Overlord is busy retrying insertion in the DB, the supervisor 
gets a `ReadTimeoutException` response
   - `ServiceClientImpl` on the supervisor task side interprets this as an 
network/IO exception and retries it an unlimited number of times. (See 
`StandardRetryPolicy.unlimited()` below)
   -  Parent `index_parallel` or `compact` task makes no progress and doesn't 
fail either
   
   
https://github.com/apache/druid/blob/9eebeead4472a44f31cdc2b9fd48919f89446ea2/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TaskMonitor.java#L109-L118
   
   ### Solution
   In truth, the violation of `max_allowed_packet` is not really a transient 
exception as it doesn't go away until the DB admin increases the configured 
limit.
   
   ### Changes
   
   - Mark the violation of `max_allowed_packet` violation as a non-transient 
exception in `SQLMetadataConnector.isTransientException()`, thus breaking the 
retry loop
   - Add tests in `SQLMetadataConnectorTest`
   
   <hr>
   
   This PR has:
   
   - [ ] been self-reviewed.
      - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] 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](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] 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](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] 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