Skip to content

Conversation

@symious
Copy link
Contributor

@symious symious commented Aug 20, 2022

What changes were proposed in this pull request?

This ticket is for creating the interface between SCM and DN. The new interfaces are as follows:

  • SCM -> DN
    • SCM send DiskBalancerCommand to datanodes to control/update diskBalancer
  • DN -> SCM
    • DN report DiskBalancerReport to SCM via heartbeat

What is the link to the Apache JIRA

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

How was this patch tested?

unit test.

message DiskBalancerConfigurationProto {
optional double threshold = 1;
optional double diskBandwidth = 2;
optional string threshold = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ChenSammi Currently ConfigurationReflectionUtil can not detect the type of "Double", so I revert the type back to string, please have a look.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Do you think it's difficult to add a double support in ConfigurationReflectionUtil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added "Double" to ConfigType in another PR, please have a look.
https://issues.apache.org/jira/browse/HDDS-7162

@symious
Copy link
Contributor Author

symious commented Aug 20, 2022

@ChenSammi @ferhui @lokeshj1703 @siddhantsangwan @sodonnel @neils-dev @JacksonYao287 Could you help to review this PR?

@symious symious changed the title HDDS-7155. Create interface between SCM and DN HDDS-7155. [DiskBalancer] Create interface between SCM and DN Aug 21, 2022
// DiskBalancerCommand diskBalancerCommand = (DiskBalancerCommand) command;
// final boolean shouldRun = diskBalancerCommand.isShouldRun();
// final DiskBalancerConfiguration configuration =
// diskBalancerCommand.getDiskBalancerConfiguration();
Copy link
Contributor

Choose a reason for hiding this comment

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

this code should be either implemented or removed. The code that is commented out, should not go to production code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review, I will comment it.



/**
* Publishes Pipeline which will be sent to SCM as part of heartbeat.
Copy link
Contributor

Choose a reason for hiding this comment

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

seems to be a copy-paste from PipelineReportPublisher.class

@ferhui
Copy link
Contributor

ferhui commented Aug 22, 2022

Hi @symious , Sammi @ChenSammi gave a comment 'Please use uint64 instead. diskBandwidth is a number without fraction. We can change it in next PR.' in the last PR. Could you change it in this PR?

defaultValue = "10", tags = {ConfigTag.DISKBALANCER},
description = "The max balance speed.")
private double diskBandwidth = 10;
private long diskBandwidth = 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check the type of all key, use the proper type instead of ConfigType.AUTO if possible.


if (heartbeat.hasDiskBalancerReport()) {
LOG.debug("Dispatching DiskBalancer Report.");
eventPublisher.fireEvent(
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy-paste result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, let me fix it.

diskBalancerManager.processDiskBalancerReport(
diskBalancerReportProto, dn);
} catch (Exception e) {
LOGGER.error("Could not process diskBalancer report={} from dn={}.",
Copy link
Contributor

@ChenSammi ChenSammi Aug 23, 2022

Choose a reason for hiding this comment

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

Could not process -> Failed to process

Preconditions.checkState(
heartbeatFrequency <= diskBalancerReportInterval,
HDDS_DISK_BALANCER_REPORT_INTERVAL +
" cannot be configured lower than heartbeat frequency.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the heart frequency value in the message to facilitate problem investigation.

// Todo: add implementation to stop DiskBalancer
}

private void updateDiskBalancerConfiguration(DiskBalancerConfiguration
Copy link
Contributor

Choose a reason for hiding this comment

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

updateDiskBalancerConfiguration -> updateDiskBalancer


message DiskBalancerReportProto {
required bool isRunning = 1;
optional int64 balancedBytes = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

int64 -> uint64

@ChenSammi
Copy link
Contributor

Hey @symious , I finished one round of review and left some comments.

@symious
Copy link
Contributor Author

symious commented Aug 23, 2022

@ChenSammi Thank you for the detailed review. I will update the PR later.

For the "Double" type issue, I will create another PR in master, hope you can have a look and we can rebase and use it in the current branch. Thank you again.

@symious
Copy link
Contributor Author

symious commented Aug 26, 2022

@ferhui Thanks for updating the patch.
@ChenSammi Conflicts after rebased has been solved, please have a look.

Copy link
Contributor

@ferhui ferhui left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@lokeshj1703 lokeshj1703 left a comment

Choose a reason for hiding this comment

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

@symious Thanks for updating the PR! I have few comments inline.

Comment on lines 115 to 119
@@ -112,11 +112,11 @@ public class StateContext {
private final ConfigurationSource conf;
private final Set<InetSocketAddress> endpoints;
// Only the latest full report of each type is kept
private final AtomicReference<GeneratedMessage> containerReports;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is to resolve the conflicts with the change of HDDS-7151.

return statusList;
// Filter Running Status by default
HddsProtos.DiskBalancerRunningStatus filterStatus =
status.orElse(HddsProtos.DiskBalancerRunningStatus.RUNNING);
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets not filter by default.

Comment on lines 131 to 134
if (runningStatus != HddsProtos.DiskBalancerRunningStatus.UNKNOWN) {
builder.setDiskBalancerConf(statusMap.get(dn)
.getDiskBalancerConfiguration().toProtobufBuilder());
}
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 report conf for STOPPED status dns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If user specified the STOPEED status dn, I think we should return the information.

Copy link
Contributor

Choose a reason for hiding this comment

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

But for STOPPED balancer, there should not exist any config right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they should have a local copy of configuration. So that they can use the latest configuration when we start them.

return hosts.contains(datanodeDetails);
boolean shouldReturn = true;
// If dn not in specified hosts, do not return
if (hosts != null && !hosts.isEmpty() && !hosts.contains(datanodeDetails)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

!hosts.isEmpty() We do not need this check.


List<DatanodeDetails> finalFilterDns = filterDns;

return nodeManager.getAllNodes().stream()
Copy link
Contributor

Choose a reason for hiding this comment

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

We are still looping through all nodes here. In case hosts is not empty we should only loop through nodes provided by the hosts input parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the for loop logic.

@ferhui
Copy link
Contributor

ferhui commented Sep 3, 2022

@ChenSammi @myskov @lokeshj1703 Thanks for your careful reviews! Do you have any other comments?

@ferhui
Copy link
Contributor

ferhui commented Sep 6, 2022

Seems no further comments. Will merge it tmr so that @symious can continue.

@ChenSammi
Copy link
Contributor

The patch LGTM, +1.

@ferhui ferhui merged commit b239018 into apache:HDDS-5713 Sep 7, 2022
@ferhui
Copy link
Contributor

ferhui commented Sep 7, 2022

@symious Thanks for your contribution. @myskov @ChenSammi @lokeshj1703 Thanks for your careful reviews! Merged.

@symious
Copy link
Contributor Author

symious commented Sep 7, 2022

@ChenSammi @ferhui @lokeshj1703 @myskov Thank you for the review.

symious added a commit to symious/ozone that referenced this pull request Mar 16, 2023
symious added a commit to symious/ozone that referenced this pull request Jan 29, 2024
sodonnel pushed a commit to sodonnel/hadoop-ozone that referenced this pull request Feb 1, 2024
sadanand48 pushed a commit to sadanand48/hadoop-ozone that referenced this pull request Apr 17, 2024
sadanand48 pushed a commit to sadanand48/hadoop-ozone that referenced this pull request Apr 17, 2024
ChenSammi pushed a commit to ChenSammi/ozone that referenced this pull request Feb 19, 2025
ChenSammi pushed a commit to ChenSammi/ozone that referenced this pull request Feb 20, 2025
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.

5 participants