amaliujia commented on code in PR #10823:
URL: https://github.com/apache/ozone/pull/10823#discussion_r3664716471
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -680,6 +681,11 @@ ContainerCommandResponseProto handlePutBlock(
long bcsId =
dispatcherContext == null ? 0 : dispatcherContext.getLogIndex();
+ if (bcsId == 0 && DispatcherContext.op(dispatcherContext) ==
DispatcherContext.Op.STREAM_LINK) {
+ // Stream close PutBlock is applied outside a Ratis log entry, so use
the
+ // next block commit sequence id after any prior PutBlock on this
container.
+ bcsId = kvContainer.getBlockCommitSequenceId() + 1;
+ }
Review Comment:
Finally I see where the issue is:
There are other PutBlocks not from the end of the stream, but from flushes
in the middle of the stream when some criteria are met. Those PutBlock are
still go through normal Ratis log and they use log index as bscid. The last
PutBlock carries bscid=0 so if we do not handle it, it will overwrite previous
PutBlocks bscid then cause a mismatch.
Right now we cannot convert previous PutBlocks to non-Ratis because we
cannot insert metadata command into the byte stream before stream is close.
After all, append PutBlock to the end of the stream and consumes it is a
"hack".
For short term fix, I added a handling in Datanode side in this PR:
https://github.com/apache/ozone/pull/10823/changes#diff-f9ad357eba1e59ae4995c6c103bfddd7d0ba7e590b2f62006210a388bc38e2d8R212-R225
Ratis data stream API does not offer a "control plane" that allow commit
metadata in the middle of the data streams. For longer term fix, we need such
API in Ratis and also migrate PutBlock from middle flushes to direct data
stream path without Ratis. Filed
https://issues.apache.org/jira/browse/HDDS-16008. Also likely we need work in
Ratis to make this happen.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]