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

improve error messages #591

Merged
merged 5 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion charts/tidb-cluster/templates/scripts/_start_pd.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ then
elif [[ ! -d /var/lib/pd/member/wal ]]
then
until result=$(wget -qO- -T 3 http://${discovery_url}/new/${encoded_domain_url} 2>/dev/null); do
echo "waiting for discovery service returns start args ..."
echo "waiting for discovery service to return start args ..."
sleep $((RANDOM % 5))
done
ARGS="${ARGS}${result}"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/pd_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ func (pc *pdClient) getBodyOK(apiURL string) ([]byte, error) {
}
defer DeferClose(res.Body, &err)
if res.StatusCode >= 400 {
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v", res.StatusCode))
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v URL %s", res.StatusCode, apiURL))
return nil, errMsg
}
body, err := ioutil.ReadAll(res.Body)
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/tidb_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (tdc *defaultTiDBControl) GetInfo(tc *v1alpha1.TidbCluster, ordinal int32)
}
defer DeferClose(res.Body, &err)
if res.StatusCode != http.StatusOK {
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v", res.StatusCode))
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v URL: %s", res.StatusCode, url))
return nil, errMsg
}
body, err := ioutil.ReadAll(res.Body)
Expand Down Expand Up @@ -146,7 +146,7 @@ func (tdc *defaultTiDBControl) GetSettings(tc *v1alpha1.TidbCluster, ordinal int
}
defer DeferClose(res.Body, &err)
if res.StatusCode != http.StatusOK {
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v", res.StatusCode))
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v URL: %s", res.StatusCode, url))
return nil, errMsg
}
body, err := ioutil.ReadAll(res.Body)
Expand All @@ -167,7 +167,7 @@ func (tdc *defaultTiDBControl) getBodyOK(apiURL string) ([]byte, error) {
return nil, err
}
if res.StatusCode >= 400 {
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v", res.StatusCode))
errMsg := fmt.Errorf(fmt.Sprintf("Error response %v URL %s", res.StatusCode, apiURL))
return nil, errMsg
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/scheduler/predicates/ha.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (h *ha) Filter(instanceName string, pod *apiv1.Pod, nodes []apiv1.Node) ([]
}

if len(minNodeNames) == 0 {
msg := fmt.Sprintf("can't scheduled to nodes: %v, because these pods had been scheduled to nodes: %v", GetNodeNames(nodes), nodeMap)
msg := fmt.Sprintf("can't schedule to nodes: %v, because these pods had been scheduled to nodes: %v", GetNodeNames(nodes), nodeMap)
h.recorder.Event(pod, apiv1.EventTypeWarning, "FailedScheduling", msg)
return nil, errors.New(msg)
}
Expand Down Expand Up @@ -202,7 +202,7 @@ func (h *ha) realAcquireLock(pod *apiv1.Pod) (*apiv1.PersistentVolumeClaim, *api
return schedulingPVC, currentPVC, err
}
if schedulingPVC.Status.Phase != apiv1.ClaimBound || schedulingPod.Spec.NodeName == "" {
return schedulingPVC, currentPVC, fmt.Errorf("waiting for Pod %s/%s scheduling", ns, strings.TrimPrefix(schedulingPVC.GetName(), component))
return schedulingPVC, currentPVC, fmt.Errorf("waiting for Pod %s/%s scheduling", ns, strings.TrimPrefix(schedulingPVC.GetName(), component+"-"))
}
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/scheduler/predicates/ha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ func TestHAFilter(t *testing.T) {
events := collectEvents(recorder.Events)
g.Expect(events).To(HaveLen(1))
g.Expect(events[0]).To(ContainSubstring("FailedScheduling"))
g.Expect(strings.Contains(err.Error(), "can't scheduled to nodes:")).To(BeTrue())
g.Expect(strings.Contains(err.Error(), "can't schedule to nodes:")).To(BeTrue())
g.Expect(len(nodes)).To(Equal(0))
},
},
Expand Down Expand Up @@ -695,7 +695,7 @@ func TestHAFilter(t *testing.T) {
events := collectEvents(recorder.Events)
g.Expect(events).To(HaveLen(1))
g.Expect(events[0]).To(ContainSubstring("FailedScheduling"))
g.Expect(strings.Contains(err.Error(), "can't scheduled to nodes:")).To(BeTrue())
g.Expect(strings.Contains(err.Error(), "can't schedule to nodes:")).To(BeTrue())
g.Expect(len(nodes)).To(Equal(0))
},
},
Expand Down Expand Up @@ -767,7 +767,7 @@ func TestHAFilter(t *testing.T) {
events := collectEvents(recorder.Events)
g.Expect(events).To(HaveLen(1))
g.Expect(events[0]).To(ContainSubstring("FailedScheduling"))
g.Expect(strings.Contains(err.Error(), "can't scheduled to nodes:")).To(BeTrue())
g.Expect(strings.Contains(err.Error(), "can't schedule to nodes:")).To(BeTrue())
g.Expect(len(nodes)).To(Equal(0))
},
},
Expand Down