Skip to content
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-12007. BlockDataStreamOutput should only send one PutBlock during close. #7645

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -689,29 +689,8 @@ public CompletableFuture<?> link(DataStream stream, LogEntryProto entry) {

final KeyValueStreamDataChannel kvStreamDataChannel =
(KeyValueStreamDataChannel) dataChannel;

final ContainerCommandRequestProto request =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we remove KeyValueStreamDataChannel#putBlockRequest, KeyValueStreamDataChannel#buffers and related code, if we remove PutBlock here ?
As I understand it, in order to create the PutBlockReques, we keep a KeyValueStreamDataChannel#buffers in memory, which guarantees that the buffers data will only be written at close. If we remove the PutBlock here, do we not need it anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xichen01 , thanks for reviewing this!

Yes, the putBlockRequest can be removed.

Unfortunately, we still need the buffers since clients still send a putBlockRequest. We need the buffers so the request won't be written to the file as data.

kvStreamDataChannel.getPutBlockRequest();

return link(request, entry).whenComplete((response, e) -> {
if (e != null) {
LOG.warn("Failed to link logEntry {} for request {}",
TermIndex.valueOf(entry), request, e);
}
if (response != null) {
final ContainerProtos.Result result = response.getResult();
if (LOG.isDebugEnabled()) {
LOG.debug("{} to link logEntry {} for request {}, response: {}",
result, TermIndex.valueOf(entry), request, response);
}
if (result == ContainerProtos.Result.SUCCESS) {
kvStreamDataChannel.setLinked();
return;
}
}
// failed to link, cleanup
kvStreamDataChannel.cleanUp();
});
kvStreamDataChannel.setLinked();
return CompletableFuture.completedFuture(null);
}

private ExecutorService getChunkExecutor(WriteChunkRequestProto req) {
Expand Down
Loading