fix site replication resync status (#18245)

To persist status changes on disk upon completion.

Adds new tests to handle this functionality.
This commit is contained in:
Poorna
2023-10-13 22:17:22 -07:00
committed by GitHub
parent e1e33077e8
commit 78f1f69d57
5 changed files with 62 additions and 6 deletions

View File

@@ -5157,8 +5157,7 @@ func (c *SiteReplicationSys) startResync(ctx context.Context, objAPI ObjectLayer
}
}()
globalSiteResyncMetrics.updateState(rs)
if err := saveSiteResyncMetadata(ctx, rs, objAPI); err != nil {
if err := globalSiteResyncMetrics.updateState(rs); err != nil {
return res, err
}
@@ -5408,6 +5407,9 @@ func loadSiteResyncMetadata(ctx context.Context, objAPI ObjectLayer, dID string)
// save resync status of peer to resync/depl-id.meta
func saveSiteResyncMetadata(ctx context.Context, ss SiteResyncStatus, objectAPI ObjectLayer) error {
if objectAPI == nil {
return errSRObjectLayerNotReady
}
data := make([]byte, 4, ss.Msgsize()+4)
// Initialize the resync meta header.