-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDDS-1843. Undetectable corruption after restart of a datanode. #1364
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
Closed
Closed
Changes from all commits
Commits
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
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 |
|---|---|---|
|
|
@@ -135,8 +135,10 @@ private boolean canIgnoreException(Result result) { | |
| } | ||
|
|
||
| @Override | ||
| public void buildMissingContainerSet(Set<Long> createdContainerSet) { | ||
| containerSet.buildMissingContainerSet(createdContainerSet); | ||
| public void buildMissingContainerSetAndValidate( | ||
| Map<Long, Long> container2BCSIDMap) { | ||
| containerSet | ||
| .buildMissingContainerSetAndValidate(container2BCSIDMap); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -185,9 +187,9 @@ private ContainerCommandResponseProto dispatchRequest( | |
| cmdType == ContainerProtos.Type.WriteChunk && (dispatcherContext == null | ||
| || dispatcherContext.getStage() | ||
| == DispatcherContext.WriteChunkStage.COMBINED); | ||
| Set<Long> containerIdSet = null; | ||
| Map<Long, Long> container2BCSIDMap = null; | ||
| if (dispatcherContext != null) { | ||
| containerIdSet = dispatcherContext.getCreateContainerSet(); | ||
| container2BCSIDMap = dispatcherContext.getContainer2BCSIDMap(); | ||
| } | ||
| if (isWriteCommitStage) { | ||
| // check if the container Id exist in the loaded snapshot file. if | ||
|
|
@@ -196,9 +198,10 @@ private ContainerCommandResponseProto dispatchRequest( | |
| // snapshot. | ||
| // just add it to the list, and remove it from missing container set | ||
| // as it might have been added in the list during "init". | ||
| Preconditions.checkNotNull(containerIdSet); | ||
| if (!containerIdSet.contains(containerID)) { | ||
| containerIdSet.add(containerID); | ||
| Preconditions.checkNotNull(container2BCSIDMap); | ||
| if (container2BCSIDMap.get(containerID) == null) { | ||
| container2BCSIDMap | ||
| .put(containerID, container.getBlockCommitSequenceId()); | ||
| containerSet.getMissingContainerSet().remove(containerID); | ||
| } | ||
| } | ||
|
|
@@ -228,11 +231,14 @@ private ContainerCommandResponseProto dispatchRequest( | |
| audit(action, eventType, params, AuditEventStatus.FAILURE, sce); | ||
| return ContainerUtils.logAndReturnError(LOG, sce, msg); | ||
| } | ||
| Preconditions.checkArgument(isWriteStage && containerIdSet != null | ||
| Preconditions.checkArgument(isWriteStage && container2BCSIDMap != null | ||
| || dispatcherContext == null); | ||
| if (containerIdSet != null) { | ||
| if (container2BCSIDMap != null) { | ||
| // adds this container to list of containers created in the pipeline | ||
| containerIdSet.add(containerID); | ||
| // with initial BCSID recorded as 0. | ||
| Preconditions | ||
| .checkArgument(!container2BCSIDMap.containsKey(containerID)); | ||
bshashikant marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| container2BCSIDMap.put(containerID, Long.valueOf(0)); | ||
| } | ||
| container = getContainer(containerID); | ||
| } | ||
|
|
@@ -313,7 +319,8 @@ private ContainerCommandResponseProto dispatchRequest( | |
| sendCloseContainerActionIfNeeded(container); | ||
| } | ||
|
|
||
| if(result == Result.SUCCESS) { | ||
| if (result == Result.SUCCESS) { | ||
| updateBCSID(container, dispatcherContext, cmdType); | ||
| audit(action, eventType, params, AuditEventStatus.SUCCESS, null); | ||
| } else { | ||
| audit(action, eventType, params, AuditEventStatus.FAILURE, | ||
|
|
@@ -329,6 +336,22 @@ private ContainerCommandResponseProto dispatchRequest( | |
| } | ||
| } | ||
|
|
||
| private void updateBCSID(Container container, | ||
| DispatcherContext dispatcherContext, ContainerProtos.Type cmdType) { | ||
| if (dispatcherContext != null && (cmdType == ContainerProtos.Type.PutBlock | ||
bshashikant marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| || cmdType == ContainerProtos.Type.PutSmallFile)) { | ||
| Preconditions.checkNotNull(container); | ||
| long bcsID = container.getBlockCommitSequenceId(); | ||
| long containerId = container.getContainerData().getContainerID(); | ||
| Map<Long, Long> container2BCSIDMap; | ||
| container2BCSIDMap = dispatcherContext.getContainer2BCSIDMap(); | ||
| Preconditions.checkNotNull(container2BCSIDMap); | ||
| Preconditions.checkArgument(container2BCSIDMap.containsKey(containerId)); | ||
| // updates the latest BCSID on every putBlock or putSmallFile | ||
| // transaction over Ratis. | ||
| container2BCSIDMap.computeIfPresent(containerId, (u, v) -> v = bcsID); | ||
|
||
| } | ||
| } | ||
| /** | ||
| * Create a container using the input container request. | ||
| * @param containerRequest - the container request which requires container | ||
|
|
||
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
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.