zpinto commented on code in PR #2657:
URL: https://github.com/apache/helix/pull/2657#discussion_r1357268766
##########
helix-core/src/main/java/org/apache/helix/model/ResourceConfig.java:
##########
@@ -389,6 +390,12 @@ public void setPreferenceLists(Map<String, List<String>>
instanceLists) {
* @throws IOException - when JSON conversion fails
*/
public Map<String, Map<String, Integer>> getPartitionCapacityMap() throws
IOException {
+ // It is very expensive to deserialize the partition capacity map every
time this is called.
+ // Cache the deserialized map to avoid the overhead.
+ if (_deserializedPartitionCapacityMap != null) {
Review Comment:
We do not call `setPartitionCapacityMap` anywhere but tests. Cache is
refreshed by replacing ResourceConfig HelixProperty in dataProvider when there
is a keyChange. We set _objMap to new HashMap<String, T> containing new value
for keys that were changed, whenever we do the refresh. Replacing the property
will ensure that _deserializedPartitionCapacityMap will be recomputed if
ResourceConfig is changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]