Skip to content

HDDS-10292. Extract configurator for size settings from MiniOzoneCluster - #6167

Merged
adoroszlai merged 9 commits into
apache:masterfrom
adoroszlai:HDDS-10292
Feb 6, 2024
Merged

HDDS-10292. Extract configurator for size settings from MiniOzoneCluster#6167
adoroszlai merged 9 commits into
apache:masterfrom
adoroszlai:HDDS-10292

Conversation

@adoroszlai

@adoroszlaiadoroszlai commented Feb 5, 2024

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Create a dedicated configurator object for setting the following properties for tests, instead of polluting MiniOzoneCluster.Builder interface:

  • blockSize
  • chunkSize
  • dataStreamBufferFlushSize
  • dataStreamMinPacketSize
  • datastreamWindowSize
  • streamBufferFlushSize
  • streamBufferMaxSize
  • streamBufferSize

The first commit in the PR (284f3ec) tries to minimize change for easier review. Follow-up commits are minor additional improvements.

Moving the default values for these properties to ozone-site.xml uncovered a problem with OzoneClientConfig construction, which is also fixed here (445db63). (See #6163 for similar fix in prod. code.)

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

How was this patch tested?

CI:
https://github.com/adoroszlai/ozone/actions/runs/7782795270

@adoroszlaiadoroszlai added test code-cleanup Changes that aim to make code better, without changing functionality. labels Feb 5, 2024
@adoroszlaiadoroszlai self-assigned this Feb 5, 2024

@szetszwoszetszwo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@adoroszlai , thanks for working on this! I have to quick comments inlined.

Comment on lines +36 to +42
private OptionalLong blockSize = OptionalLong.empty();
private OptionalInt streamBufferSize = OptionalInt.empty();
private OptionalLong streamBufferFlushSize = OptionalLong.empty();
private OptionalLong dataStreamBufferFlushSize = OptionalLong.empty();
private OptionalLong dataStreamWindowSize = OptionalLong.empty();
private OptionalLong streamBufferMaxSize = OptionalLong.empty();
private OptionalInt dataStreamMinPacketSize = OptionalInt.empty();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's also change the fields to not to use Optional. In general, it is not a good practice to use Optional as a field. See this comment by Brian Goetz (the main author of Java Concurrency in Practice).

You should almost never use it as a field of something or a method parameter.

/**
* Helper for tests that want to set client stream properties.
*/
public final class ClientConfigBuilder {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this is for testing only, how about calling git ClientConfigForTesting?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for the suggestion. I wasn't quite happy with the original name, but couldn't find a better one.

@szetszwoszetszwo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 the change looks good.

@adoroszlai
adoroszlai merged commit 60bcdaf into apache:masterFeb 6, 2024
@adoroszlai

Copy link
Copy Markdown
ContributorAuthor

Thanks @szetszwo for the review.

@adoroszlai
adoroszlai deleted the HDDS-10292 branch February 6, 2024 20:57
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-cleanupChanges that aim to make code better, without changing functionality.test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@adoroszlai@szetszwo