[ 
https://issues.apache.org/jira/browse/HDDS-11388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Andika resolved HDDS-11388.
--------------------------------
    Resolution: Fixed

> 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: Balancer, SCM
>    Affects Versions: 2.0.0
>            Reporter: Siddhant Sangwan
>            Assignee: Ivan Andika
>            Priority: Major
>              Labels: pull-request-available
>
> {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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to