You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "YongGang (via GitHub)" <gi...@apache.org> on 2024/05/13 21:16:07 UTC

[PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

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

   <!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
   
   <!-- If you are a committer, follow the PR action item checklist for committers:
   https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
   
   ### Description
   
   <!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
   
   <!-- Describe your patch: what did you change in code? How did you fix the problem? -->
   
   <!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
   
   This PR introduces functionality to prevent unnecessary task creation and associated costs when record parsing exceptions exceed the `maxAllowedParseExceptions` threshold. Currently, when this threshold is reached, the streaming ingestion task fails, and subsequent tasks continue to fail. This cycle persists until the Supervisor specification is updated to handle the problematic data or until the `maxAllowedParseExceptions` setting is increased.
   
   With the changes introduced in this PR, if the `maxAllowedParseExceptions` limit is violated, the Supervisor will now halt the creation of new tasks. This prevents the initiation of tasks that are likely to fail due to the same parsing issues, thereby reducing unnecessary resource consumption and cost implications.
   
   <!--
   In each section, please describe design decisions made, including:
    - Choice of algorithms
    - Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
    - Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
    - Method organization and design (how the logic is split between methods, parameters and return types)
    - Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
   -->
   
   
   <!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
   
   <!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
   
   <!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
   
   #### Release note
   <!-- Give your best effort to summarize your changes in a couple of sentences aimed toward Druid users. 
   
   If your change doesn't have end user impact, you can skip this section.
   
   For tips about how to write a good release note, see [Release notes](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#release-notes).
   
   -->
   
   
   <hr>
   
   ##### Key changed/added classes in this PR
   
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16442:
URL: https://github.com/apache/druid/pull/16442#issuecomment-2232051754

   This pull request has been marked as stale due to 60 days of inactivity.
   It will be closed in 4 weeks if no further activity occurs. If you think
   that's incorrect or this pull request should instead be reviewed, please simply
   write any comment. Even if closed, you can still revive the PR at any time or
   discuss it on the dev@druid.apache.org list.
   Thank you for your contributions.


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #16442: Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions
URL: https://github.com/apache/druid/pull/16442


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16442:
URL: https://github.com/apache/druid/pull/16442#issuecomment-2287476714

   This pull request/issue has been closed due to lack of activity. If you think that
   is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "YongGang (via GitHub)" <gi...@apache.org>.
YongGang commented on PR #16442:
URL: https://github.com/apache/druid/pull/16442#issuecomment-2116659070

   > Why limit this functionality just to stuck supervisors because of parse exceptions? If a supervisor is failing continuously (because of OOMs or something else) and the offsets to read from are not moving forward, it seems like stopping the supervisor and notifying the operator would be a good thing to do.
   
   In the case of task OOM errors occurring in the MiddleManager, the issue might stem from other processes running on the same host, which temporarily consume excessive memory. When these processes terminate—say, within 10 minutes—the memory pressure might alleviate, allowing tasks to resume normal operation. Therefore, halting task creation in response to transient or uncertain issues like OOM may not always be appropriate, as the situation might resolve itself without needing operator intervention.
   In contrast, parse exceptions directly impact the Supervisor's ability to process data correctly and are not self-resolving. These issues unequivocally require operator intervention to adjust parsing logic or data format expectations. In such cases, stopping the Supervisor and notifying the operator ensures that no further tasks fail due to the same unaddressed issue, which is a necessary measure.
   This approach balances responsiveness to critical, actionable issues with avoidance of unnecessary interruptions in cases where conditions may soon return to normal.
   


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "YongGang (via GitHub)" <gi...@apache.org>.
YongGang commented on PR #16442:
URL: https://github.com/apache/druid/pull/16442#issuecomment-2111716253

   Thanks for your early review @kfaraz !
   
   > - If the supervisor is not going to launch tasks, would it make sense to just move the supervisor to an idle state rather than introduce a new state?
   > 
   > - Rather than introduce a new config, why not reuse the existing idleConfig (https://druid.apache.org/docs/latest/ingestion/kafka-ingestion/#idle-configuration). That was also introduced keeping in mind cost concerns and unnecessary task launches. We could just add a new field to idleConfig which dictates the supervisor to become idle if maxAllowedParseExceptions is violated.
   
   The primary distinction between the existing idle state and the newly introduced `UNHEALTHY_TASKS_STOP_CREATING_NEW` state is that the former represents a healthy condition, indicating that there are no further records to process. In contrast, `UNHEALTHY_TASKS_STOP_CREATING_NEW` is an unhealthy state. It can be seen as an extension of the existing `UNHEALTHY_TASKS` state, signifying not only that all tasks have failed or are unhealthy but also that no new tasks will be created due to the errors. This state requires intervention by a user or operator to restore it to a healthy condition.
   
   > - I am not sure if the "no progress" check is really going to be effective or if it is even desirable. There could be other reasons behind not making progress and not all of them would qualify for making the supervisor idle.
   
   The Supervisor will transition to the new `UNHEALTHY_TASKS_STOP_CREATING_NEW` state only if three conditions are met: "no progress" AND all failed task are due to parsing exceptions AND the count of failed task exceed `TaskUnhealthinessThreshold`. Under these circumstances, we can attribute the parsing exceptions as the root cause of the Supervisor's lack of progress.
   
   > - What if maxAllowedParseExceptions keeps getting violated for some partitions and not for others. The task launched for the former partitions would always fail but should we become idle in this case or just not launch tasks to read from the bad partitions?
   
   In this case that means Supervisor is making progress, we won't stop Supervisor from launching new tasks. Because transitioning to the `UNHEALTHY_TASKS_STOP_CREATING_NEW` state results in a halt to new task initiation, we approach this transition with great caution to ensure it is absolutely necessary.


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #16442:
URL: https://github.com/apache/druid/pull/16442#issuecomment-2110205615

   Thanks for the improvement, @YongGang . It makes sense to not create new tasks if they are going to inevitably fail.
   
   Even though this PR is still in draft, I have some suggestions/queries that you could try to incorporate early in the design:
   - If the supervisor is not going to launch tasks, would it make sense to just move the supervisor to an `idle state` rather than introduce a new state?
   - Rather than introduce a new config, why not reuse the existing `idleConfig` (https://druid.apache.org/docs/latest/ingestion/kafka-ingestion/#idle-configuration). That was also introduced keeping in mind cost concerns and unnecessary task launches. We could just add a new field to `idleConfig` which dictates the supervisor to become idle if `maxAllowedParseExceptions` is violated.
   - It should be easy for the user to figure out __why__ the supervisor was moved to the idle state.
   - Based on the PR description, this seems fairly tied in to the `maxAllowedParseExceptions` but the code changes don't seem to be using `maxAllowedParseExceptions` anywhere. Is there any other scenario where we would want to make the supervisor idle?
   - What if `maxAllowedParseExceptions` keeps getting violated for some partitions and not for others. The task launched for the former partitions would always fail but should we become idle in this case or just not launch tasks to read from the bad partitions?
   - I am not sure if the "no progress" check is really going to be effective or if it is even desirable. There could be other reasons behind not making progress and not all of them would qualify for making the supervisor idle.
   - The `StateManager.markRunFinished()` now accepts a `Boolean` which is almost always passed as `null` except in one or two places. Please consider adding a separate method instead.
   
   


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Enable Supervisor to Halt New Task Creation on Record Parsing Exceptions (druid)

Posted by "suneet-s (via GitHub)" <gi...@apache.org>.
suneet-s commented on PR #16442:
URL: https://github.com/apache/druid/pull/16442#issuecomment-2114023021

   > The Supervisor will transition to the new UNHEALTHY_TASKS_STOP_CREATING_NEW state only if three conditions are met: "no progress" AND all failed task are due to parsing exceptions AND the count of failed task exceed TaskUnhealthinessThreshold. Under these circumstances, we can attribute the parsing exceptions as the root cause of the Supervisor's lack of progress.
   
   Why limit this functionality just to stuck supervisors because of parse exceptions? If a supervisor is failing continuously (because of OOMs or something else) and the offsets to read from are not moving forward, it seems like stopping the supervisor and notifying the operator would be a good thing to do. 


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org