Skip to content

'suspend' and 'resume' support for supervisors (kafka indexing service, materialized views) - #6234

Merged
jon-wei merged 9 commits into
apache:masterfrom
clintropolis:kafka-supervisor-suspend-resume
Sep 13, 2018
Merged

jon-wei merged 9 commits into
apache:masterfrom
clintropolis:kafka-supervisor-suspend-resume

Conversation

@clintropolis

@clintropolis clintropolis commented Aug 26, 2018 •

Copy link
Copy Markdown
Member

changes:

  • extends SupervisorSpec interface to describe supervisors which support suspend/resume functionality controlled through the SupervisorManager, which will gracefully shutdown the supervisor and it's tasks, update it's SupervisorSpec with either a suspended or running state, and update with the toggled spec. Spec updates are provided by SupervisorSpec.createSuspendedSpec and SupervisorSpec.createRunningSpec respectively.
  • KafkaSupervisorSpec now supports suspend/resume functionality. The difference in behavior between 'running' and 'suspended' state is whether the supervisor will attempt to ensure that indexing tasks are or are not running respectively. Behavior is identical otherwise.
  • MaterializedViewSupervisorSpec now supports suspend/resume functionality. MaterializedViewSupervisor when suspended will effectively do nothing until resumed.
  • SupervisorResource now provides /druid/indexer/v1/supervisor/{id}/suspend and /druid/indexer/v1/supervisor/{id}/resume which are used to suspend/resume supervisors
  • Deprecated /druid/indexer/v1/supervisor/{id}/shutdown and moved it's functionality to /druid/indexer/v1/supervisor/{id}/terminate since 'shutdown' is ambiguous verbage for something that effectively stops a supervisor forever
  • Added ability to get all supervisor specs from /druid/indexer/v1/supervisor by supplying the 'full' query parameter /druid/indexer/v1/supervisor?full which will return a list of json objects of the form {"id":<id>, "spec":<SupervisorSpec>}
  • Updated overlord console ui to enable suspend/resume, and changed 'shutdown' to 'terminate'

screen shot 2018-08-24 at 5 03 44 pm

screen shot 2018-08-24 at 5 03 33 pm

@clintropolis

Copy link
Copy Markdown
Member Author

Updated overlord ui to move supervisor status to own column after seeing it look terribad with multiple rows, now looks like this:
screen shot 2018-08-27 at 1 55 43 pm

@clintropolis
clintropolis force-pushed the kafka-supervisor-suspend-resume branch from ead8d13 to d9e8470 Compare August 30, 2018 20:18
@gianm gianm added this to the 0.13.0 milestone Aug 31, 2018

void createNewTasks() throws JsonProcessingException
{
if (spec.isSuspended()) {

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.

Is this needed, since createNewTasks() is only called when not suspended?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so, I'll remove.

'<a href="/druid/indexer/v1/supervisor/' + supervisorId + '/history">history</a>' +
(supervisorSpec.suspended ?
'<a style="padding-right:5px;" onclick="resumeSupervisor(\'' + supervisorId + '\');">resume</a>' :
'<a onclick="suspendSupervisor(\'' + supervisorId + '\');">suspend</a>'

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.

this would show a suspend button for tasks that don't support suspend, though that's a moot point if all the supervisors support suspend

@jon-wei jon-wei 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.

LGTM, I'll take another look after you update the PR to support suspend across all supervisors

changes:
* introduces `SuspendableSupervisorSpec` interface to describe supervisors which support suspend/resume functionality controlled through the `SupervisorManager`, which will gracefully shutdown the supervisor and it's tasks, update it's `SupervisorSpec` with either a suspended or running state, and update with the toggled spec. Spec updates are provided by `SuspendableSupervisorSpec.createSuspendedSpec` and `SuspendableSupervisorSpec.createRunningSpec` respectively.
* `KafkaSupervisorSpec` extends `SuspendableSupervisorSpec` and now supports suspend/resume functionality. The difference in behavior between 'running' and 'suspended' state is whether the supervisor will attempt to ensure that indexing tasks are or are not running respectively. Behavior is identical otherwise.
* `SupervisorResource` now provides `/druid/indexer/v1/supervisor/{id}/suspend` and `/druid/indexer/v1/supervisor/{id}/resume` which are used to suspend/resume suspendable supervisors
* Deprecated `/druid/indexer/v1/supervisor/{id}/shutdown` and moved it's functionality to `/druid/indexer/v1/supervisor/{id}/terminate` since 'shutdown' is ambiguous verbage for something that effectively stops a supervisor forever
* Added ability to get all supervisor specs from `/druid/indexer/v1/supervisor` by supplying the 'full' query parameter `/druid/indexer/v1/supervisor?full` which will return a list of json objects of the form `{"id":<id>, "spec":<SupervisorSpec>}`
* Updated overlord console ui to enable suspend/resume, and changed 'shutdown' to 'terminate'
@clintropolis
clintropolis force-pushed the kafka-supervisor-suspend-resume branch from 881aa08 to f2f8ebd Compare September 12, 2018 23:05
@clintropolis clintropolis changed the title 'suspend' and 'resume' support for kafka indexing service 'suspend' and 'resume' support for supervisors (kafka indexing service, materialized views) Sep 12, 2018
@jon-wei
jon-wei merged commit 91a37c6 into apache:master Sep 13, 2018
@clintropolis
clintropolis deleted the kafka-supervisor-suspend-resume branch September 13, 2018 21:57
authorizedSupervisorIds.stream()
.map(x -> ImmutableMap.<String, Object>builder()
.put("id", x)
.put("spec", manager.getSupervisorSpec(x).get())

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.

Calls Optional.get() without a check

riovic918data pushed a commit to riovic918data/druid that referenced this pull request Jun 12, 2026
…e, materialized views) (apache#6234)

* 'suspend' and 'resume' support for kafka indexing service
changes:
* introduces `SuspendableSupervisorSpec` interface to describe supervisors which support suspend/resume functionality controlled through the `SupervisorManager`, which will gracefully shutdown the supervisor and it's tasks, update it's `SupervisorSpec` with either a suspended or running state, and update with the toggled spec. Spec updates are provided by `SuspendableSupervisorSpec.createSuspendedSpec` and `SuspendableSupervisorSpec.createRunningSpec` respectively.
* `KafkaSupervisorSpec` extends `SuspendableSupervisorSpec` and now supports suspend/resume functionality. The difference in behavior between 'running' and 'suspended' state is whether the supervisor will attempt to ensure that indexing tasks are or are not running respectively. Behavior is identical otherwise.
* `SupervisorResource` now provides `/druid/indexer/v1/supervisor/{id}/suspend` and `/druid/indexer/v1/supervisor/{id}/resume` which are used to suspend/resume suspendable supervisors
* Deprecated `/druid/indexer/v1/supervisor/{id}/shutdown` and moved it's functionality to `/druid/indexer/v1/supervisor/{id}/terminate` since 'shutdown' is ambiguous verbage for something that effectively stops a supervisor forever
* Added ability to get all supervisor specs from `/druid/indexer/v1/supervisor` by supplying the 'full' query parameter `/druid/indexer/v1/supervisor?full` which will return a list of json objects of the form `{"id":<id>, "spec":<SupervisorSpec>}`
* Updated overlord console ui to enable suspend/resume, and changed 'shutdown' to 'terminate'

* move overlord console status to own column in supervisor table so does not look like garbage

* spacing

* padding

* other kind of spacing

* fix rebase fail

* fix more better

* all supervisors now suspendable, updated materialized view supervisor to support suspend, more tests

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants