-
Notifications
You must be signed in to change notification settings - Fork 188
*: show an unsynced message for workers which didn't get any shard DDL #1638
Conversation
102c131
to
8c08720
Compare
@Ehco1996: In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
dm/master/server.go
Outdated
unsyncedMap := make(map[string]map[string]struct{}) | ||
for _, resp := range resps { | ||
for _, subtaskStatus := range resp.SubTaskStatus { | ||
syncStatus := subtaskStatus.GetSync() | ||
if syncStatus == nil { | ||
continue | ||
} | ||
for _, group := range syncStatus.UnresolvedGroups { | ||
if _, ok := unsyncedMap[subtaskStatus.Name]; !ok { | ||
unsyncedMap[subtaskStatus.Name] = make(map[string]struct{}) | ||
} | ||
unsyncedMap[subtaskStatus.Name][group.Target] = struct{}{} | ||
} | ||
} | ||
} | ||
for _, resp := range resps { | ||
for _, subtaskStatus := range resp.SubTaskStatus { | ||
syncStatus := subtaskStatus.GetSync() | ||
if syncStatus == nil { | ||
continue | ||
} | ||
found := make(map[string]struct{}, len(syncStatus.UnresolvedGroups)) | ||
for _, group := range syncStatus.UnresolvedGroups { | ||
found[group.Target] = struct{}{} | ||
} | ||
for target := range unsyncedMap[subtaskStatus.Name] { | ||
if _, ok := found[target]; ok { | ||
continue | ||
} | ||
syncStatus.UnresolvedGroups = append(syncStatus.UnresolvedGroups, &pb.ShardingGroup{ | ||
Target: target, | ||
Unsynced: []string{"this DM-worker doesn't receive any shard DDL of this group"}, | ||
}) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weak advice: can we use a separate function for this part and add a unit test for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold |
/unhold |
/hold If user only queries one source not whole task, current code is not awared of unsynced workers. So I will change the implementation to use |
/unhold |
any test for optimistic mode? |
seems optimistic mode will discover sources in a shard group lazily, so a totally unsynchronized DM-worker is not counted into shard group. will check later |
Oh currently query-status doesn't show Line 51 in 423c81d
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 8f56e5e
|
In response to a cherrypick label: new pull request created: #1650. |
What problem does this PR solve?
some users don't use
show-ddl-locks
to get unsynced tables, they usequery-status
instead, so we also show reasonable message inquery-status
What is changed and how it works?
Check List
Tests
Code changes
Related changes