You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Siddhant Sangwan (Jira)" <ji...@apache.org> on 2024/08/29 11:29:00 UTC
[jira] [Created] (HDDS-11388) Unnecessary call to the Database in ContainerBalancer
Siddhant Sangwan created HDDS-11388:
---------------------------------------
Summary: Unnecessary call to the Database in ContainerBalancer
Key: HDDS-11388
URL: https://issues.apache.org/jira/browse/HDDS-11388
Project: Apache Ozone
Issue Type: Bug
Components: SCM
Affects Versions: 1.5.0
Reporter: Siddhant Sangwan
{code}
/**
* Get balancer status info.
*
* @return balancer status info if balancer started
*/
public ContainerBalancerStatusInfo getBalancerStatusInfo() throws IOException {
if (isBalancerRunning()) {
ContainerBalancerConfigurationProto configProto = readConfiguration(ContainerBalancerConfigurationProto.class);
return new ContainerBalancerStatusInfo(
this.startedAt,
configProto,
task.getCurrentIterationsStatistic()
);
} else {
return null;
}
}
{code}
`{{readConfiguration(ContainerBalancerConfigurationProto.class)}}` reads from SCM's RocksDB. Is this really necessary? At this point we've already determined that balancer is running, so it must have read configuration from the database into memory. We should try to just reuse that.
Also as it stands, this code is not thread-safe because another thread could be writing to the table at the same time.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org