-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-7383. Basic framework of DiskBalancerService #3874
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
Conversation
|
@ChenSammi @ferhui @lokeshj1703 @siddhantsangwan @sodonnel @neils-dev @JacksonYao287 Could you help to review this PR? |
| LoggerFactory.getLogger(DiskBalancerConfiguration.class); | ||
|
|
||
| // The path where datanode diskBalancer's conf is to be written to. | ||
| public static final String HDDS_DATANODE_DISK_BALANCER_INFO_DIR = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These configuration properties should be put to ozone-default.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lokeshj1703 Could you help to check this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments that if this property is not defined, ozone will fallback to use meta data directory instead.
| private static final Logger LOG = | ||
| LoggerFactory.getLogger(StorageVolume.class); | ||
|
|
||
| public static final String TMP_DIR = "tmp"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it makes sense to parametrize this (like hdds.datanode.replication.work.dir for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be related to another ticket, https://issues.apache.org/jira/browse/HDDS-6449.
I think we can resolve this value after HDDS-6449.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @symious , does your previous container replication improvement patch cover this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can not find the definition of "tmp" now, seems being removed from StorageVolume class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tmp dir defined in HDDS-6449 , in review, currently defines the tmp directory in the HddsVolume. Does it need to be defined in this the underlying base class? What was discussed in the previous patch was,
hdds/clusterID/tmp would be the best place to put it, but we need to make sure this will not affect datanode startup on downgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neils-dev , I think define tmp in StorageVolume is more generic than define it in HddsVolume, in case in future other types of Volume need tmp too. what do you think?
...r-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerYaml.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerServiceTestImpl.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerServiceTestImpl.java
Outdated
Show resolved
Hide resolved
| Optional<List<String>> hosts) throws IOException { | ||
| // TODO: Send message to datanodes | ||
| return new ArrayList<DatanodeAdminError>(); | ||
| // check admin authorisation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this comment is redundant
| throws IOException { | ||
| // TODO: Send message to datanodes | ||
| return new ArrayList<DatanodeAdminError>(); | ||
| // check admin authorisation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this comment is redundant
| throws IOException { | ||
| // TODO: Send message to datanodes | ||
| return new ArrayList<DatanodeAdminError>(); | ||
| // check admin authorisation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this comment is redundant
...ainer-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/package-info.java
Show resolved
Hide resolved
|
@myskov Thank you for the review. Updated the PR, please have a look. |
hey guys! Let's continue back to gradually digest this PR when we have some time! lol |
| public void setDiskBalancerTimeout(Duration duration) { | ||
| this.diskBalancerTimeout = duration.toMillis(); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move all disk balancer related configuration to DiskBalancerConfiguration?
| UNKNOWN = 3; | ||
| } | ||
|
|
||
| enum DatanodeDiskBalancerOpType{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DatanodeDiskBalancerOpType -> DiskBalancerOpType, consistent with DiskBalancerRunningStatus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, please have a check.
| public static final String | ||
| HDDS_DATANODE_DISK_BALANCER_CONTAINER_CHOOSING_POLICY = | ||
| "hdds.datanode.disk.balancer.container.choosing.policy"; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these three property have the default value? Can they use the @config format as other properties in this file?
| case update: | ||
| diskBalancerInfo.updateFromConf(diskBalancerConf); | ||
| break; | ||
| default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please throw exception here.
| List<DatanodeDetails> dns; | ||
| if (hosts.isPresent()) { | ||
| dns = NodeUtils.mapHostnamesToDatanodes(nodeManager, hosts.get(), | ||
| useHostnames); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should avoid send command to dn which is not healthy too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, please have a check.
| private boolean shouldRun; | ||
| private double threshold; | ||
| private long bandwidthInMB; | ||
| private int parallelThread; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a field to identify the version number. In future, there could be new item added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenSammi Could you share some more infor on the "version number"? I didn't quite get the idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version number is usually to support the backward compatibility.
Currently, these four properties are persistent on disk, let's say it's V1. In future, for example, to support one bandwidthInMB for night time, and one bandwidthInMB in day time, then there will be new properties need persist, it is V2.
If ozone binaries are upgraded to V2, but the on disk info file is still V1, then ozone should recognize the file format as V1 and properly handle it. With a version number persist, we can do that. You can refer to the layout version in container file.
@ChenSammi Yes, there should be many conflicts between this PR and master. I will try to do the rebase late this week. |
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java
Outdated
Show resolved
Hide resolved
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/OzoneContainer.java
Show resolved
Hide resolved
...src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerServiceMetrics.java
Show resolved
Hide resolved
...ervice/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
Outdated
Show resolved
Hide resolved
...ervice/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
Show resolved
Hide resolved
...ervice/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java
Show resolved
Hide resolved
...-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/storage/DiskBalancerConfiguration.java
Outdated
Show resolved
Hide resolved
...-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/storage/DiskBalancerConfiguration.java
Outdated
Show resolved
Hide resolved
...-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/storage/DiskBalancerConfiguration.java
Outdated
Show resolved
Hide resolved
| tags = { DATANODE, ConfigTag.DISKBALANCER}, | ||
| description = "The version of the disk balancer service" | ||
| ) | ||
| private String diskBalancerVersion = "ONE"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Numeric version string would be nice (1.0). Same with Config version default value. Any particular reason it is not? Better fidelity with numeric value string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@symious , we don't need to expose this version as a configurable property. We can remove it in this class.
|
|
||
| public DiskBalancerConfiguration(Optional<Double> threshold, | ||
| Optional<Long> bandwidthInMB, | ||
| Optional<Integer> parallelThread) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DiskBalancerConfiguration constructor and state variables for configuration do not appear to include the balancePolicy configuration that is documented in the design doc. Is it an oversight? It would be great to include it in the basic framework PR and support balancePolicies, default DefaultBalancePolicy, can balance between different disk mediums.
include the following configurations:
threshold: threshold is used to calculate the volume data density to decide which datanode is empty and needs balance.
bandwidth: a parameter to control the balance speed, so that the balance job won't affect the datanode's IO performance.
parallelThreads: a parameter that determines how many balance jobs are running simultaneously.
balancePolicy: the policy to choose which disk to balance, for example, only balance between SSD disks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neils-dev Thanks for the review.
I was preparing to add the balancePolicy part in another ticket after the basic framework.
| private static final Logger LOG = | ||
| LoggerFactory.getLogger(StorageVolume.class); | ||
|
|
||
| public static final String TMP_DIR = "tmp"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tmp dir defined in HDDS-6449 , in review, currently defines the tmp directory in the HddsVolume. Does it need to be defined in this the underlying base class? What was discussed in the previous patch was,
hdds/clusterID/tmp would be the best place to put it, but we need to make sure this will not affect datanode startup on downgrade.
|
The last patch LGTM +1. Thanks @symious for working on this, and @myskov @neils-dev for the code review. |
What changes were proposed in this pull request?
HDDS-7233 is a big patch that is not good for review.
I will split HDDS-7233 to multi smaller tickets.
This ticket introduces the DiskBalancerService on Datanode side, while the detailed implementation of move operation will be added in other tickets.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-7383
How was this patch tested?
unit test.