Skip to content

HDDS-15656. Fix non-atomic data size accumulation in ContainerBalancer move callback#10708

Open
sreejasahithi wants to merge 1 commit into
apache:masterfrom
sreejasahithi:HDDS-15656
Open

HDDS-15656. Fix non-atomic data size accumulation in ContainerBalancer move callback#10708
sreejasahithi wants to merge 1 commit into
apache:masterfrom
sreejasahithi:HDDS-15656

Conversation

@sreejasahithi

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

When multiple container moves finish at the same time, each move runs a callback on its own thread.
The balancer was updating moved data size with a plain long (sizeActuallyMovedInLatestIteration += ...).
This update is not thread safe, so some bytes could be lost and the reported moved size could be low.

This PR updates moved bytes through the existing balancer metrics in the callback, the same way move counts are already updated.

What is the link to the Apache JIRA

HDDS-15656

How was this patch tested?

Green CI : https://github.com/sreejasahithi/ozone/actions/runs/29022183864

@chihsuan chihsuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix! @sreejasahithi Overall LGTM. 👍

A couple of quick questions:

  • With the callback now updating the metric live, is reading it in both the finished and unfinished paths in getDataMoveInfo intentional?
  • Would a small unit test be worth adding, or do the existing balancer tests cover it?

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.

2 participants