jackjlli commented on code in PR #8820:
URL: https://github.com/apache/pinot/pull/8820#discussion_r888460056
##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/BaseServerStarter.java:
##########
@@ -343,10 +343,17 @@ private void updateInstanceConfigIfNeeded(ServerConf
serverConf) {
}
// Update system resource info (CPU, memory, etc)
- Map<String, String> systemResourceInfoMap = new
SystemResourceInfo().toMap();
- if
(!systemResourceInfoMap.equals(znRecord.getMapField(Instance.SYSTEM_RESOURCE_INFO_KEY)))
{
- LOGGER.info("Updating instance: {} with system resource info: {}",
_instanceId, systemResourceInfoMap);
- znRecord.setMapField(Instance.SYSTEM_RESOURCE_INFO_KEY,
systemResourceInfoMap);
+ Map<String, String> newSystemResourceInfoMap = new
SystemResourceInfo().toMap();
+ Map<String, String> oldSystemResourceInfoMap =
+
znRecord.getMapField(CommonConstants.Helix.Instance.SYSTEM_RESOURCE_INFO_KEY);
+ if (!newSystemResourceInfoMap.equals(oldSystemResourceInfoMap)) {
+ LOGGER.info("Updating instance: {} with new system resource info: {}",
_instanceId, newSystemResourceInfoMap);
+ // oldSystemResourceInfoMap may contains more KV pairs than
newSystemResourceInfoMap, we need add the extra KV
+ // pairs into newSystemResourceInfoMap.
+ for (Map.Entry<String, String> entry :
oldSystemResourceInfoMap.entrySet()) {
Review Comment:
This logic seems incorrect. You now basically replace the new KV pair with
old value.
--
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]