[
https://issues.apache.org/jira/browse/HDDS-11223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ChenXi updated HDDS-11223:
--------------------------
Target Version/s: 2.0.0, 1.4.1 (was: 2.0.0)
> Datanode checksum validation in EC bucket does not work
> -------------------------------------------------------
>
> Key: HDDS-11223
> URL: https://issues.apache.org/jira/browse/HDDS-11223
> Project: Apache Ozone
> Issue Type: Bug
> Affects Versions: 2.0.0
> Reporter: Kirill Sizov
> Assignee: Kirill Sizov
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.0.0
>
>
> *Steps to reproduce*
> - Enable hdds.datanode.chunk.data.validation.check property.
> - put any file into a EC bucket
> The output a client gets is:
> {noformat}
> INTERNAL_ERROR No enough datanodes to choose. TotalNodes = 10 AvailableNodes
> = 4 RequiredNodes = 5 ExcludedNodes = 6 UsedNodes = 0
> {noformat}
> *Investigation details*
> The issue comes from incorrect checksum validation on the datanode side.
> Here are the details:
> 1. {{KeyValueHandler.validateChunkChecksumData}} calls
> {{Checksum.verifyChecksum}}
> 2. {{Checksum.verifyChecksum}} calls {{checksum.computeChecksum(data)}} to
> calculate a checksum over the received data
> 3. {{checksum.computeChecksum}} has the following block:
> {code}
> for (ByteBuffer b : data.iterate(bytesPerChecksum)) {
> checksumList.add(computeChecksum(b, function, bytesPerChecksum));
> }
> {code}
> The issue is that {{data.iterate()}} may return byte buffers of an arbitrary
> size.
> Specifically, it is observed on {{ChunkBufferImplWithByteBufferList}} which
> was created from a {{RopeByteString}} in {{KeyValueHandler.handleWriteChunk}}:
> {code}
> data =
> ChunkBuffer.wrap(writeChunk.getData().asReadOnlyByteBufferList());
> {code}
> So checksums rely on the fact the the requested data buffer is split into
> parts of the requested size (and a smaller final one),
> but {{ChunkBufferImplWithByteBufferList}} for some reason declares the
> opposite.
> {code}
> // See ChunkBufferImplWithByteBufferList:
> /**
> * Returns the next buffer in the list irrespective of the bufferSize.
> */
> @Override
> public Iterable<ByteBuffer> iterate(int bufferSize) {
> {code}
> And that implementation contradicts with the interface:
> {code}
> // ChunkBuffer:
> /**
> * Iterate the buffer from the current position to the current limit.
> * Upon the iteration complete,
> * the buffer's position will be equal to its limit.
> *
> * @param bufferSize the size of each buffer in the iteration.
> */
> Iterable<ByteBuffer> iterate(int bufferSize);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]