Skip to content

HDDS-5797. Support setting Datanode Reserved Space in MiniOzoneCluster.#2695

Merged
adoroszlai merged 4 commits into
apache:masterfrom
siddhantsangwan:HDDS-5797
Oct 1, 2021
Merged

HDDS-5797. Support setting Datanode Reserved Space in MiniOzoneCluster.#2695
adoroszlai merged 4 commits into
apache:masterfrom
siddhantsangwan:HDDS-5797

Conversation

@siddhantsangwan
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Support setting org.apache.hadoop.hdds.scm.ScmConfigKeys#HDDS_DATANODE_DIR_DU_RESERVED for each volume in each Datanode in MiniOzoneCluster (sets the same reserved space for each volume).

What is the link to the Apache JIRA

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

How was this patch tested?

Passed TestMiniOzoneCluster

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @siddhantsangwan.

Comment on lines +34 to +39
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
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.

Nit: please avoid moving around imports unnecessarily.

Comment on lines +821 to +823
datanodeReservedSpace.ifPresent(
s -> dnConf.set(ScmConfigKeys.HDDS_DATANODE_DIR_DU_RESERVED,
dir + ":" + s));
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 the same config property is set for each volume, reserved space would only be set for the last one. It should be set once, outside the loop, similar to HDDS_DATANODE_DIR_KEY.

Can you please add an assertion in TestMiniOzoneCluster#testMultipleDataDirs to verify behavior?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the unit test: Is there a better way than adding a reservedInBytes getter to VolumeInfo for testing, and then asserting its value for each volume?

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.

Is there a better way than adding a reservedInBytes getter to VolumeInfo for testing, and then asserting its value for each volume?

Sounds good enough to me.

protected Optional<String> omId = Optional.empty();

protected Boolean randomContainerPort = true;
protected Optional<String> datanodeReservedSpace = Optional.of("0B");
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.

I think a better default value would be:

Suggested change
protected Optional<String> datanodeReservedSpace = Optional.of("0B");
protected Optional<String> datanodeReservedSpace = Optional.empty();

@siddhantsangwan
Copy link
Copy Markdown
Contributor Author

@adoroszlai Thanks for the review. I've updated the PR.

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @siddhantsangwan for updating the patch.

Copy link
Copy Markdown
Contributor

@JacksonYao287 JacksonYao287 left a comment

Choose a reason for hiding this comment

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

thanks @siddhantsangwan for this work, the changes looks good to me , +1!

@adoroszlai adoroszlai merged commit c886a2f into apache:master Oct 1, 2021
@adoroszlai
Copy link
Copy Markdown
Contributor

Thanks @siddhantsangwan for the patch, @JacksonYao287 for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants