Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add design to introduce restore volume info #7610

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

reasonerjt
Copy link
Contributor

@reasonerjt reasonerjt commented Apr 2, 2024

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.86%. Comparing base (13f4efd) to head (ab5ee7b).
Report is 55 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7610      +/-   ##
==========================================
+ Coverage   61.68%   61.86%   +0.18%     
==========================================
  Files         263      266       +3     
  Lines       28826    29456     +630     
==========================================
+ Hits        17781    18224     +443     
- Misses       9787     9941     +154     
- Partials     1258     1291      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
// RestoreVolumeInfoTracker is used to track the volume information during restore.
// It is used to generate the RestoreVolumeInfo array.
type RestoreVolumeInfoTracker struct {
*sync.Mutex
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain more on why the mutex is needed here?
Didn't find where it is used.

Copy link
Contributor Author

@reasonerjt reasonerjt Apr 2, 2024

Choose a reason for hiding this comment

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

It's introduced to make tracker thread-safe, considering velero may improve parallelism to handle multiple resources in one restore in future.
An example of usage:

func (t *RestoreVolumeInfoTracker) TrackNativeSnapshot(pvName string, snapshotHandle, volumeType, volumeAZ string, iops int64) {
	t.Lock()
	defer t.Unlock()
	t.pvNativeSnapshotMap[pvName] = NativeSnapshotInfo{
		SnapshotHandle: snapshotHandle,
		VolumeType:     volumeType,
		VolumeAZ:       volumeAZ,
		IOPS:           strconv.FormatInt(iops, 10),
	}
}

@ywk253100 ywk253100 merged commit d631517 into vmware-tanzu:main Apr 9, 2024
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants