You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org> on 2024/04/02 11:39:33 UTC
[PR] Handle task location fetch from overlord during rolling upgrades (druid)
AmatyaAvadhanula opened a new pull request, #16227:
URL: https://github.com/apache/druid/pull/16227
### Bug:
https://github.com/apache/druid/pull/15724 - introduced a bug where a rolling upgrade would cause all task locations returned by the Overlord on an older version to be unknown.
Prior to #15724,
1) OverlordResource#`getTaskStatus` for individual tasks fetched a TaskStatusResponse containing the location.
2) OverlordResource#`getMultipleTaskStatuses` fetched task statuses in a batch from the metadata store. The metadata store doesn't contain the current location of an active task. Complete tasks do contain them
After the changes,
1) OverlordResource#`getTaskStatus` remains unchanged.
2) OverlordResource#`getMultipleTaskStatuses` fetches task statuses for in-memory tasks from the TaskQueue and enhances them with the location from the task runner. The method fetches task statuses for completed tasks from the db.
The Overlord client was also changed to rely on the 2nd API to fetch the task status and location from memory.
During a rolling upgrade, the task is on a version with the PR's changes and queries the 2nd API. The overlord is still on the older version and fails to return the correct location for active tasks. This can lead to task failures during rolling upgrades.
### Fix
The overlord client now falls back to the orignal API that always returns the task location if the 2nd API fails to return it during the rolling upgrade. After the rolling upgrade, the active tasks' statuses will be fetched from memory as expected.
### Testing
The new overlord client was used on an upgraded Indexer / MM while the Overlord was on a version prior to #15724. The tasks succeeded as expected. (They would fail with a newer Indexer without this patch).
This PR has:
- [x] 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.
- [x] 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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #16227:
URL: https://github.com/apache/druid/pull/16227
--
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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #16227:
URL: https://github.com/apache/druid/pull/16227#issuecomment-2032258149
I don't think it is desirable to fall back to another API within the OverlordClientImpl.
The OverlordClient methods are meant to have 1-to-1 correspondence with the Overlord APIs. Also, it is used in several places and some callers might actually want the result of the API itself even if the location turns out to be empty.
It would make more sense to have the fallback logic in the specific task service locator class.
--
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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #16227:
URL: https://github.com/apache/druid/pull/16227#discussion_r1555450155
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/client/IndexerWorkerManagerClient.java:
##########
@@ -65,21 +67,39 @@ public Map<String, TaskStatus> statuses(Set<String> taskIds)
@Override
public TaskLocation location(String workerId)
{
- final TaskStatus response = FutureUtils.getUnchecked(
- overlordClient.taskStatuses(ImmutableSet.of(workerId)),
- true
- ).get(workerId);
-
- if (response != null) {
- return response.getLocation();
- } else {
- return TaskLocation.unknown();
- }
+ return locationFetcher.getLocation(workerId);
}
@Override
public void close()
{
// Nothing to do. The OverlordServiceClient is closed by the JVM lifecycle.
}
+
+ private class TaskLocationFetcher
+ {
+ TaskLocation getLocation(String workerId)
+ {
+ final TaskStatus taskStatus = FutureUtils.getUnchecked(
+ overlordClient.taskStatuses(ImmutableSet.of(workerId)),
+ true
+ ).get(workerId);
+
+ if (taskStatus != null
+ && TaskLocation.unknown().equals(taskStatus.getLocation())) {
Review Comment:
Typo:
```suggestion
&& !TaskLocation.unknown().equals(taskStatus.getLocation())) {
```
##########
server/src/main/java/org/apache/druid/rpc/indexing/SpecificTaskServiceLocator.java:
##########
@@ -199,4 +208,20 @@ public void close()
}
}
}
+
+ private class TaskLocationFetcher
Review Comment:
Ideally, this wrapper should have the whole logic of calling the first API, handling its future and then calling the second API.
--
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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #16227:
URL: https://github.com/apache/druid/pull/16227#discussion_r1566643287
##########
server/src/main/java/org/apache/druid/rpc/indexing/SpecificTaskServiceLocator.java:
##########
@@ -199,4 +208,20 @@ public void close()
}
}
}
+
+ private class TaskLocationFetcher
Review Comment:
Edit: Resolving this as doing this would be much more involved for this PR.
--
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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #16227:
URL: https://github.com/apache/druid/pull/16227#issuecomment-2033513702
> Would it be ok to add a parameter within the Overlord client to fallback to the older API? The locations are needed not only in SpecificTaskServiceLocator but also IndexerWorkerManagerClient. It seems a bit involved with added duplication to do it outside the client.
I feel it is okay to have duplication in this case for the time being.
--
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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on PR #16227:
URL: https://github.com/apache/druid/pull/16227#issuecomment-2033507982
> It would make more sense to have the fallback logic in the specific task service locator class.
Would it be ok to add a parameter within the Overlord client to fallback to the older API? The locations are needed not only in `SpecificTaskServiceLocator` but also `IndexerWorkerManagerClient`. It seems a bit involved with added duplication to do it outside the client.
--
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] Handle task location fetch from overlord during rolling upgrades (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on PR #16227:
URL: https://github.com/apache/druid/pull/16227#issuecomment-2033506147
> It would make more sense to have the fallback logic in the specific task service locator class.
--
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