-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-11254. Reconcile commands should be handled by datanode ReplicationSupervisor #7076
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
Merged
kerneltime
merged 13 commits into
apache:HDDS-10239-container-reconciliation
from
errose28:HDDS-11254-rep-supervisor
Aug 21, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6f60842
Pass objects into reconciliation as needed
errose28 6f68df6
Merge branch 'HDDS-10239-container-reconciliation' into HDDS-11254-re…
errose28 b648f18
Use test helpers to cut down handler ctor usage and code duplication
errose28 d852fcd
Remove client from being passed through reconciliation replication task
errose28 8f78341
Update reconcile command handler test
errose28 fbf2838
Add equality test and check for reconciliation task
errose28 6316f16
Checkstyle
errose28 a6192ca
Fix comments after checking diff
errose28 16cc7dc
Unregister metrics on stop of checksum manager
errose28 ecc0910
Fix rat and findbugs
errose28 fc5c712
Checkstyle again
errose28 7946c4a
Fix accidental line deletion in test
errose28 d4fcadc
Hash with peers, remove TODO
errose28 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...vice/src/main/java/org/apache/hadoop/ozone/container/checksum/ReconcileContainerTask.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hadoop.ozone.container.checksum; | ||
|
|
||
| import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController; | ||
| import org.apache.hadoop.ozone.container.replication.AbstractReplicationTask; | ||
| import org.apache.hadoop.ozone.protocol.commands.ReconcileContainerCommand; | ||
| import org.apache.hadoop.util.Time; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Used to execute a container reconciliation task that has been queued from the ReplicationSupervisor. | ||
| */ | ||
| public class ReconcileContainerTask extends AbstractReplicationTask { | ||
| private final ReconcileContainerCommand command; | ||
| private final DNContainerOperationClient dnClient; | ||
| private final ContainerController controller; | ||
|
|
||
| private static final Logger LOG = | ||
| LoggerFactory.getLogger(ReconcileContainerTask.class); | ||
|
|
||
| public ReconcileContainerTask(ContainerController controller, | ||
| DNContainerOperationClient dnClient, ReconcileContainerCommand command) { | ||
| super(command.getContainerID(), command.getDeadline(), command.getTerm()); | ||
| this.command = command; | ||
| this.controller = controller; | ||
| this.dnClient = dnClient; | ||
| } | ||
|
|
||
| @Override | ||
| public void runTask() { | ||
| long start = Time.monotonicNow(); | ||
|
|
||
| LOG.info("{}", this); | ||
|
|
||
| try { | ||
| controller.reconcileContainer(dnClient, command.getContainerID(), command.getPeerDatanodes()); | ||
| setStatus(Status.DONE); | ||
| long elapsed = Time.monotonicNow() - start; | ||
| LOG.info("{} completed in {} ms", this, elapsed); | ||
kerneltime marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } catch (Exception e) { | ||
| long elapsed = Time.monotonicNow() - start; | ||
| setStatus(Status.FAILED); | ||
| LOG.warn("{} failed in {} ms", this, elapsed, e); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| protected Object getCommandForDebug() { | ||
| return command.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
| ReconcileContainerTask that = (ReconcileContainerTask) o; | ||
| return Objects.equals(command, that.command); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(getContainerId()); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.