Skip to content

Conversation

@jojochuang
Copy link
Contributor

What changes were proposed in this pull request?

Piggyback PutBlock in WriteChunk if the size to be flushed is small.

Please describe your PR in detail:

  • This PR adds an client side boolean configuration key ozone.client.stream.putblock.piggybacking to merge PutBlock request into WriteChunk, if the chunk size to be flushed to DataNode is small.
  • Client will detect if the DataNode supports this feature via DatanodeVersion COMBINED_PUTBLOCK_WRITECHUNK_RPC. The feature does not take effect unless DataNode supports it.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-9130

How was this patch tested?

Unit test, integration test. Manually tested on a real cluster.
Hsync throughput and latency has noticeable improvement with this patch.

@jojochuang jojochuang changed the title Hdds 9130 rebase on hdds 9752 HDDS-9130. [hsync] Combine WriteData and PutBlock requests into one Jan 11, 2024
@jojochuang jojochuang requested a review from ChenSammi January 11, 2024 18:05
@jojochuang
Copy link
Contributor Author

@ashishkumar50

@jojochuang jojochuang added the hbase HBase on Ozone support label Jan 23, 2024
@jojochuang jojochuang force-pushed the HDDS-9130_rebase_on_HDDS-9752 branch from 43b8acc to 0a0700b Compare January 24, 2024 00:45
@jojochuang jojochuang force-pushed the HDDS-9130_rebase_on_HDDS-9752 branch from 0a0700b to 3f355e5 Compare February 8, 2024 08:29
@jojochuang jojochuang marked this pull request as ready for review February 8, 2024 18:39
@jojochuang
Copy link
Contributor Author

@ashishkumar50

@jojochuang jojochuang requested a review from smengcl February 8, 2024 18:39
Rebased on HDDS-9752.

Client side implementation.

Change-Id: I4ff1c3148970edb8820a30dfda607a8aff3f7a52

incomplete server side impl.

Change-Id: I3a52c931a4bd60a747ae47737f78df23046d1053

Passed TestHSync

Change-Id: Ia70db6af5ed295fdb8fdc55b998a8233dc86c416

Fix bug.

When write finishes a full chunk, the chunk is written to DataNode, but the currentChuk is not updated.
Therefore, the flusher need to check if the chunk is full or not, and if full, skip writing chunk (because it is already written out).

Change-Id: I8685b1894466ec7ebd1bc80c49809523dac4855e

Remove debug messages.

Change-Id: I6678899c7f03317ad5fbd02298e80dd534a3308a

Fix tests and checkstyle

Change-Id: I18363e9e3f8b0255adda4fcd40bde0929283256c

Fix test

Change-Id: Ic9765ee2ec1c15c4558d91380416604dea4f981e

Fix counter

Change-Id: Ifac56842f36bcca0bfd29d9da7873a98d36134e7

Add a new datanode version. Client do not piggyback PutBlock requests if datanode is not upgraded.

Add DN version check

Update checkstyle

Fix configuration key problem.

(cherry picked from commit 8ab02b7)

Do not execute PutBlock in WRITE_DATA; only do it in COMMIT_DATA phase.

Merge duplicate code.

Checkstyle and refactory

Fix bug

Enable piggyback for the two tests.

eckstyle
@jojochuang jojochuang force-pushed the HDDS-9130_rebase_on_HDDS-9752 branch from 3f355e5 to 0a4ef7d Compare March 11, 2024 22:55
Change-Id: Ibdb80368b67248d2ca3d44bc6e4c6c756ee41852
Change-Id: I42fd82ccca3e871375acb5256a9da2ff913ab325
Change-Id: I3531fc4fe7d912300b1c02cca48a7e66f468faf0
Copy link
Contributor

@ashishkumar50 ashishkumar50 left a comment

Choose a reason for hiding this comment

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

@jojochuang Thanks for the patch, Please find the comments inline.

}
} else {
updateFlushLength();
executePutBlock(close, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Whether PutBlock required here for small chunk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the typical case (no hflush) where a PutBlock is sent to update metadata after four 1-MB chunks are sent via WriteChunk requests)

if (config.getIncrementalChunkList()) {
// remove any chunks in the containerBlockData list.
// since they are sent.
containerBlockData.clearChunks();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to remove last chunk as well here which is updated in updateBlockDataForWriteChunk in case of IncrementalChunkList?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No --
lastChunk is used to calculate checksum in PutBlock (PutBlock contains metadata)
whereas containerBlockData is sent by WriteChunk (WriteChunk contains written data)

Change-Id: Iec511ccf2a975c2cac0e76301bb0affb16df56dc
KeyValue.newBuilder().setKey(FULL_CHUNK).build();

// Flushed chunk less than 100KB will combine PutBlock and WriteChunk in the same request.
private static final int SMALL_CHUNK_THRESHOLD = 100 * 1024;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this configurable?

.writeChunk(kvContainer, blockID, chunkInfo, data, dispatcherContext);

final boolean isCommit = dispatcherContext.getStage().isCommit();
if (isCommit && writeChunk.hasBlock()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we check COMBINED_PUTBLOCK_WRITECHUNK_RPC is finalized here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

COMBINED_PUTBLOCK_WRITECHUNK_RPC doesn't have the concept of "finalize". Once the runtime is updated, the datanode version becomes COMBINED_PUTBLOCK_WRITECHUNK_RPC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

which should make sense because this PR does not change on-disk format.

Change-Id: Ic0928f7d57248496dd8596332d90db7312d4ad95
Change-Id: I53ed73ca0611cacc387ddd5559f6bbd5d8dc1b17
@jojochuang
Copy link
Contributor Author

Thanks. Updated. Those are good suggestions.

Copy link
Contributor

@ChenSammi ChenSammi left a comment

Choose a reason for hiding this comment

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

The last patch LGTM. Thanks @jojochuang , and @ashishkumar50 for the review.

@ChenSammi ChenSammi merged commit 91e5d2e into apache:HDDS-7593 Apr 1, 2024
jojochuang added a commit to jojochuang/ozone that referenced this pull request Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hbase HBase on Ozone support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants