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

fix: skip the sync peer that does not belong to the scheduler cluster #3731

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion manager/job/sync_peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import (
resource "d7y.io/dragonfly/v2/scheduler/resource/standard"
)

// SyncPeers is an interface for sync peers.
// SyncPeers is an interface for sync peers. It is only supported in Rust client,
// refer to https://github.com/dragonflyoss/client.
type SyncPeers interface {
// CreateSyncPeers creates sync peers job, and merge the sync peer results with the data
// in the peer table in the database. It is a synchronous operation, and it will returns
Expand Down Expand Up @@ -195,6 +196,13 @@ func (s *syncPeers) mergePeers(ctx context.Context, scheduler models.Scheduler,
// Convert sync peer results from slice to map.
syncPeers := make(map[string]*resource.Host, len(results))
for _, result := range results {
// Skip the sync peer that does not belong to the scheduler cluster,
// it is only supported in Rust client. The golang client lacks the
// SchedulerClusterID field.
if result.SchedulerClusterID == 0 {
continue
}

syncPeers[result.ID] = result
}

Expand Down
Loading