-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-12421. ContainerReportHandler should not make the call to delete replicas #7976
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
Changes from all commits
8ba9e8d
ff0f98f
ea69cb0
818e889
aa76bc8
f205a6d
647a400
dc9ac6b
1bc4181
e5962e4
f1971c4
08d11c9
65a2876
fb77bae
c26e3df
e854276
a132b80
448a568
c7717d8
a027755
d1f96a5
99a6601
c94aff8
f96df52
849eb62
e710734
b221882
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,7 +245,7 @@ private boolean updateContainerState(final DatanodeDetails datanode, | |
|
|
||
| final ContainerID containerId = container.containerID(); | ||
| boolean ignored = false; | ||
|
|
||
| boolean replicaIsEmpty = replica.hasIsEmpty() && replica.getIsEmpty(); | ||
| switch (container.getState()) { | ||
| case OPEN: | ||
| /* | ||
|
|
@@ -351,27 +351,29 @@ private boolean updateContainerState(final DatanodeDetails datanode, | |
| * The container is already in closed state. do nothing. | ||
| */ | ||
| break; | ||
| case DELETED: | ||
| // If container is in DELETED state and the reported replica is empty, delete the empty replica. | ||
| // We should also do this for DELETING containers and currently DeletingContainerHandler does that | ||
| if (replicaIsEmpty) { | ||
| deleteReplica(containerId, datanode, publisher, "DELETED", false); | ||
| break; | ||
| } | ||
| case DELETING: | ||
| /* | ||
| HDDS-11136: If a DELETING container has a non-empty CLOSED replica, the container should be moved back to CLOSED | ||
| state. | ||
| * HDDS-11136: If a DELETING container has a non-empty CLOSED replica, the container should be moved back to | ||
| * CLOSED state. | ||
| * | ||
| * HDDS-12421: If a DELETING or DELETED container has a non-empty replica, the container should also be moved | ||
| * back to CLOSED state. | ||
| */ | ||
| boolean replicaStateAllowed = replica.getState() == State.CLOSED; | ||
| boolean replicaNotEmpty = replica.hasIsEmpty() && !replica.getIsEmpty(); | ||
| if (replicaStateAllowed && replicaNotEmpty) { | ||
| logger.info("Moving DELETING container {} to CLOSED state, datanode {} reported replica with state={}, " + | ||
| "isEmpty={} and keyCount={}.", containerId, datanode.getHostName(), replica.getState(), false, | ||
| replica.getKeyCount()); | ||
| containerManager.transitionDeletingToClosedState(containerId); | ||
| boolean replicaStateAllowed = (replica.getState() != State.INVALID && replica.getState() != State.DELETED); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @siddhantsangwan btw this change failed Pls double check if this is the desired behavior. (Transitions DELETING EC container straight to CLOSED after receiving a CLOSING replica report, which sounds fine to me.)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have the same behavior for EC and Ratis. A non-empty replica moves the container back to CLOSED.
sumitagrawl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (!replicaIsEmpty && replicaStateAllowed) { | ||
| logger.info("Moving container {} from {} to CLOSED state, datanode {} reported replica with state={}, " + | ||
smengcl marked this conversation as resolved.
Show resolved
Hide resolved
sumitagrawl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "isEmpty={}, bcsId={}, keyCount={}, and origin={}", | ||
| container, container.getState(), datanode.getHostName(), replica.getState(), | ||
| replica.getIsEmpty(), replica.getBlockCommitSequenceId(), replica.getKeyCount(), replica.getOriginNodeId()); | ||
| containerManager.transitionDeletingOrDeletedToClosedState(containerId); | ||
| } | ||
|
|
||
| break; | ||
| case DELETED: | ||
| /* | ||
| * The container is deleted. delete the replica. | ||
| */ | ||
| deleteReplica(containerId, datanode, publisher, "DELETED"); | ||
| ignored = true; | ||
| break; | ||
| default: | ||
| break; | ||
|
|
@@ -453,9 +455,9 @@ protected ContainerManager getContainerManager() { | |
| } | ||
|
|
||
| protected void deleteReplica(ContainerID containerID, DatanodeDetails dn, | ||
| EventPublisher publisher, String reason) { | ||
| EventPublisher publisher, String reason, boolean force) { | ||
| SCMCommand<?> command = new DeleteContainerCommand( | ||
| containerID.getId(), true); | ||
| containerID.getId(), force); | ||
| try { | ||
| command.setTerm(scmContext.getTermOfLeader()); | ||
| } catch (NotLeaderException nle) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
@siddhantsangwan I have a question, do we have cases where
replica.hasIsEmpty() == false?Right now,
replicaIsEmptywould befalsewhen the replica doesn't have theisEmptyfield. So!replicaIsEmptybecomestruebelow and we effectively treat such replicas as non-empty (which is fine).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.
Looks to me like it is ok to omit the existence check for the field, but Siddhant should confirm.
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.
I don't know either.
This behaviour seems fine to me, we shouldn't be deleting replicas if the
isEmptyfield is not present at all. Let's keep the current behaviour as it is.