-
Notifications
You must be signed in to change notification settings - Fork 511
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
HDDS-10374. Make container scanner generate merkle trees during the scan #7490
base: HDDS-10239-container-reconciliation
Are you sure you want to change the base?
Changes from all commits
a8b8dbc
999a913
b0d1ba9
382bce2
28b1889
dc182e8
a3401a9
a25d44d
7550a3c
847f8d8
452c294
dc45eca
1cb291f
d6b21d2
2a2dbbd
c9a077c
0bbbdc5
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 |
---|---|---|
|
@@ -547,6 +547,15 @@ ContainerCommandResponseProto handleCloseContainer( | |
return getSuccessResponse(request); | ||
} | ||
|
||
/** | ||
* Write the merkle tree for this container using the existing checksum metadata only. The data is not read or | ||
* validated by this method, so it is expected to run quickly. | ||
* | ||
* If a checksum file already exists on the disk, this method will do nothing. The existing file would have either | ||
* been made from the metadata or data itself so there is no need to recreate it from the metadata. | ||
* | ||
* @param container The container which will have a tree generated. | ||
*/ | ||
private void createContainerMerkleTree(Container container) { | ||
if (ContainerChecksumTreeManager.checksumFileExist(container)) { | ||
return; | ||
|
@@ -560,8 +569,9 @@ private void createContainerMerkleTree(Container container) { | |
getBlockIterator(containerData.getContainerID())) { | ||
while (blockIterator.hasNext()) { | ||
BlockData blockData = blockIterator.nextBlock(); | ||
List<ContainerProtos.ChunkInfo> chunkInfos = blockData.getChunks(); | ||
merkleTree.addChunks(blockData.getLocalID(), chunkInfos); | ||
// All chunks are assumed to be healthy until the scanner inspects them to determine otherwise. | ||
merkleTree.addChunks(blockData.getLocalID(), true, | ||
blockData.getChunks().toArray(new ContainerProtos.ChunkInfo[0])); | ||
} | ||
} | ||
checksumManager.writeContainerDataTree(containerData, merkleTree); | ||
|
@@ -1348,7 +1358,6 @@ public void markContainerUnhealthy(Container container, ScanResult reason) | |
} finally { | ||
container.writeUnlock(); | ||
} | ||
createContainerMerkleTree(container); | ||
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. If a container moves from |
||
// Even if the container file is corrupted/missing and the unhealthy | ||
// update fails, the unhealthy state is kept in memory and sent to | ||
// SCM. Write a corresponding entry to the container log as well. | ||
|
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.
Can we not add the block when we add the first chunk?