-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if supervisor could be idle on startup #16844
Check if supervisor could be idle on startup #16844
Conversation
e0a044c
to
c34ad09
Compare
).anyTimes(); | ||
EasyMock.reset(spec); | ||
EasyMock.expect(spec.isSuspended()).andReturn(false).anyTimes(); | ||
EasyMock.expect(spec.getDataSchema()).andReturn(getDataSchema()).anyTimes(); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
SeekableStreamSupervisorSpec.getDataSchema
server/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorStateManager.java
Show resolved
Hide resolved
.../main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, rest looks good to me.
.../main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java
Outdated
Show resolved
Hide resolved
.../main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought through all the possible cases and i think this will work. i think some comments in the logic would be helpful though, like explaining each scenario
- running supervisor with data, overlord restarts
- new supervisor with data on running overlord
- running supervisor that stops getting data
for future changes to the code
verifyAll(); | ||
|
||
int taskCountAfterScale = supervisor.getIoConfig().getTaskCount(); | ||
Assert.assertEquals(2, taskCountAfterScale); | ||
Assert.assertEquals(SupervisorStateManager.BasicState.IDLE, supervisor.getState()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an invalid test. There are no actuals tasks running to consume the lag and go to idle. It used to work previously because reporting thread is yet to be executed before the completion of test and computeLag
implied null as 0
lag. But with us now updating the lag proactively this fails.
Fixes #13936.
Description
In cases where a supervisor is idle and the overlord is restarted for some reason, the supervisor would start spinning tasks again. In clusters where there are many low throughput stream this spike the task count unnecessarily. This PR checks if the latest offset with that of the ones committed in metadata during the startup of supervisor and sets it idle state if they match.
Release note
Supervisor would not go back into running state from the idle if the overlord restart happens for some reason.
Key changed/added classes in this PR
SeekableStreamSupervisor
This PR has: