Skip to content

Commit

Permalink
Merge branch 'master' into cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lhy1024 authored Jun 8, 2020
2 parents 11ea733 + 4e8b16d commit 2130d65
Show file tree
Hide file tree
Showing 49 changed files with 639 additions and 278 deletions.
20 changes: 8 additions & 12 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
---
name: "🐛 Bug Report"
about: Something isn't working as expected
title: ''
labels: 'kind/bug'
labels: 'type/bug'
---

Please answer these questions before submitting your issue. Thanks!
## Bug Report

1. What did you do?
If possible, provide a recipe for reproducing the error.
<!-- Please answer these questions before submitting your issue. Thanks! -->

### What did you do?

2. What did you expect to see?
<!-- If possible, provide a recipe for reproducing the error. -->

### What did you expect to see?

### What did you see instead?

3. What did you see instead?



4. What version of PD are you using (`pd-server -V`)?

### What version of PD are you using (`pd-server -V`)?
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/development-task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: "🗒️ Development Task"
about: As a developer, I want to record a development task.
labels: type/enhancement
---

## Development Task
12 changes: 8 additions & 4 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ labels: type/enhancement

## Feature Request

### Describe your feature request related problem:
### Describe your feature request related problem

<!-- A description of what the problem is. -->

### Describe the feature you'd like:
### Describe the feature you'd like

<!-- A description of what you want to happen. -->

### Describe alternatives you've considered:
### Describe alternatives you've considered

<!-- A description of any alternative solutions or features you've considered. -->

### Teachability, Documentation, Adoption, Migration Strategy:
### Teachability, Documentation, Adoption, Migration Strategy

<!-- If you can, explain some scenarios how users might use this, or situations in which it would be helpful. Any API designs, mockups, or diagrams are also helpful. -->
8 changes: 3 additions & 5 deletions .github/ISSUE_TEMPLATE/performance-challenge-program.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
name: "✈️ Performance Challenge Program"
about: PCP Season1 Program
title: 'PCP: '
labels: ''
assignees: ''

labels: 'PCP-S1'
---

## PCP Issue
Expand All @@ -16,6 +14,6 @@ assignees: ''
- Recommended Skills:
- Mentor(s):

## Description
### Description

<!-- Add issue description here -->
<!-- Add issue description here. -->
22 changes: 11 additions & 11 deletions .github/ISSUE_TEMPLATE/usability-challenge-program.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
name: "🏪 Usability Challenge Program"
about: UCP Season1 Program
title: 'UCP: '
labels: ''
assignees: ''

labels: 'challenge-program-2'
---

## Description
## UCP Issue

### Description

<!-- Add the issue description here -->
<!-- Add the issue description here. -->

## Score
### Score

<!-- Add the score which the contributor will obtain once this issue is solved -->
<!-- Add the score which the contributor will obtain once this issue is solved. -->

## Mentor
### Mentor

<!-- Add the mentor of this issue -->
<!-- Add the mentor of this issue. -->

## Recommended Skills
### Recommended Skills

<!-- Add the description about what kind of skills does the contributor should have to solve this issue. -->

## Learning Materials
### Learning Materials

<!-- Add the description about what kind of materials does the contributor need to learn to solve this issue. -->
14 changes: 9 additions & 5 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
addReviewers: true
addAssignees: author
addReviewers: false
addAssignees: true
numberOfReviewers: 0
numberOfAssignees: 1
useReviewGroups: true
reviewGroups:
useReviewGroups: false
useAssigneeGroups: true
assigneeGroups:
scheduling:
- nolouch
- disksing
- lhy1024
- shafreeck
- HunDunDM
- rleungx
useAssigneeGroups: false
filterLabels:
# Run
include:
- contribution
40 changes: 24 additions & 16 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,45 @@ PR Title Format:
2. *: what's changed
-->

### What problem does this PR solve? <!--add the issue link with summary if it exists-->
### What problem does this PR solve?

<!-- Add the issue link with a summary if it exists. -->

### What is changed and how it works?

### Check List

### Check List <!--REMOVE the items that are not applicable-->
<!-- Remove the items that are not applicable. -->

Tests <!-- At least one of them must be included. -->
Tests

- Unit test
- Integration test
- Manual test (add detailed scripts or steps below)
- No code
<!-- At least one of them must be included. -->

- Unit test
- Integration test
- Manual test (add detailed scripts or steps below)
- No code

Code changes

- Has configuration change
- Has HTTP API interfaces change (Don't forget to [add the declarative for API](https://github.com/pingcap/pd/blob/master/docs/development.md#updating-api-documentation))
- Has persistent data change
- Has configuration change
- Has HTTP API interfaces change (Don't forget to [add the declarative for API](https://github.com/pingcap/pd/blob/master/docs/development.md#updating-api-documentation))
- Has persistent data change

Side effects

- Possible performance regression
- Increased code complexity
- Breaking backward compatibility
- Possible performance regression
- Increased code complexity
- Breaking backward compatibility

Related changes

- PR to update `pingcap/docs`/`pingcap/docs-cn`:
- PR to update `pingcap/tidb-ansible`:
- PR to update [`pingcap/docs`](https://github.com/pingcap/docs)/[`pingcap/docs-cn`](https://github.com/pingcap/docs-cn):
- PR to update [`pingcap/tidb-ansible`](https://github.com/pingcap/tidb-ansible):
- Need to cherry-pick to the release branch

### Release note <!-- bugfixes or new feature need a release note -->
### Release note

<!-- A bugfix or a new feature needs a release note. If there is no need release note, just uncomment the below line. -->

<!-- - No release note -->
12 changes: 11 additions & 1 deletion client/base_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ type baseClient struct {
security SecurityOption

gRPCDialOptions []grpc.DialOption

timeout time.Duration
}

// SecurityOption records options about tls
Expand All @@ -66,6 +68,13 @@ func WithGRPCDialOptions(opts ...grpc.DialOption) ClientOption {
}
}

// WithCustomTimeoutOption configures the client with timeout option.
func WithCustomTimeoutOption(timeout time.Duration) ClientOption {
return func(c *baseClient) {
c.timeout = timeout
}
}

// newBaseClient returns a new baseClient.
func newBaseClient(ctx context.Context, urls []string, security SecurityOption, opts ...ClientOption) (*baseClient, error) {
ctx1, cancel := context.WithCancel(ctx)
Expand All @@ -75,6 +84,7 @@ func newBaseClient(ctx context.Context, urls []string, security SecurityOption,
ctx: ctx1,
cancel: cancel,
security: security,
timeout: defaultPDTimeout,
}
c.connMu.clientConns = make(map[string]*grpc.ClientConn)
for _, opt := range opts {
Expand Down Expand Up @@ -163,7 +173,7 @@ func (c *baseClient) initClusterID() error {
ctx, cancel := context.WithCancel(c.ctx)
defer cancel()
for _, u := range c.urls {
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, pdTimeout)
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, c.timeout)
members, err := c.getMembers(timeoutCtx, u)
timeoutCancel()
if err != nil || members.GetHeader() == nil {
Expand Down
24 changes: 12 additions & 12 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type tsoRequest struct {
}

const (
pdTimeout = 3 * time.Second
defaultPDTimeout = 3 * time.Second
dialTimeout = 3 * time.Second
updateLeaderTimeout = time.Second // Use a shorter timeout to recover faster from network isolation.
maxMergeTSORequests = 10000
Expand Down Expand Up @@ -238,7 +238,7 @@ func (c *client) tsLoop() {
}
done := make(chan struct{})
dl := deadline{
timer: time.After(pdTimeout),
timer: time.After(c.timeout),
done: done,
cancel: cancel,
}
Expand Down Expand Up @@ -455,7 +455,7 @@ func (c *client) GetRegion(ctx context.Context, key []byte) (*Region, error) {
start := time.Now()
defer func() { cmdDurationGetRegion.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().GetRegion(ctx, &pdpb.GetRegionRequest{
Header: c.requestHeader(),
RegionKey: key,
Expand All @@ -478,7 +478,7 @@ func (c *client) GetPrevRegion(ctx context.Context, key []byte) (*Region, error)
start := time.Now()
defer func() { cmdDurationGetPrevRegion.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().GetPrevRegion(ctx, &pdpb.GetRegionRequest{
Header: c.requestHeader(),
RegionKey: key,
Expand All @@ -501,7 +501,7 @@ func (c *client) GetRegionByID(ctx context.Context, regionID uint64) (*Region, e
start := time.Now()
defer func() { cmdDurationGetRegionByID.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().GetRegionByID(ctx, &pdpb.GetRegionByIDRequest{
Header: c.requestHeader(),
RegionId: regionID,
Expand All @@ -527,7 +527,7 @@ func (c *client) ScanRegions(ctx context.Context, key, endKey []byte, limit int)
var cancel context.CancelFunc
scanCtx := ctx
if _, ok := ctx.Deadline(); !ok {
scanCtx, cancel = context.WithTimeout(ctx, pdTimeout)
scanCtx, cancel = context.WithTimeout(ctx, c.timeout)
defer cancel()
}

Expand All @@ -553,7 +553,7 @@ func (c *client) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, e
start := time.Now()
defer func() { cmdDurationGetStore.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().GetStore(ctx, &pdpb.GetStoreRequest{
Header: c.requestHeader(),
StoreId: storeID,
Expand Down Expand Up @@ -589,7 +589,7 @@ func (c *client) GetAllStores(ctx context.Context, opts ...GetStoreOption) ([]*m
start := time.Now()
defer func() { cmdDurationGetAllStores.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().GetAllStores(ctx, &pdpb.GetAllStoresRequest{
Header: c.requestHeader(),
ExcludeTombstoneStores: options.excludeTombstone,
Expand All @@ -613,7 +613,7 @@ func (c *client) UpdateGCSafePoint(ctx context.Context, safePoint uint64) (uint6
start := time.Now()
defer func() { cmdDurationUpdateGCSafePoint.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().UpdateGCSafePoint(ctx, &pdpb.UpdateGCSafePointRequest{
Header: c.requestHeader(),
SafePoint: safePoint,
Expand Down Expand Up @@ -641,7 +641,7 @@ func (c *client) UpdateServiceGCSafePoint(ctx context.Context, serviceID string,
start := time.Now()
defer func() { cmdDurationUpdateServiceGCSafePoint.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().UpdateServiceGCSafePoint(ctx, &pdpb.UpdateServiceGCSafePointRequest{
Header: c.requestHeader(),
ServiceId: []byte(serviceID),
Expand All @@ -666,7 +666,7 @@ func (c *client) ScatterRegion(ctx context.Context, regionID uint64) error {
start := time.Now()
defer func() { cmdDurationScatterRegion.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
resp, err := c.leaderClient().ScatterRegion(ctx, &pdpb.ScatterRegionRequest{
Header: c.requestHeader(),
RegionId: regionID,
Expand All @@ -689,7 +689,7 @@ func (c *client) GetOperator(ctx context.Context, regionID uint64) (*pdpb.GetOpe
start := time.Now()
defer func() { cmdDurationGetOperator.Observe(time.Since(start).Seconds()) }()

ctx, cancel := context.WithTimeout(ctx, pdTimeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
defer cancel()
return c.leaderClient().GetOperator(ctx, &pdpb.GetOperatorRequest{
Header: c.requestHeader(),
Expand Down
4 changes: 4 additions & 0 deletions conf/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,7 @@ location-labels = []
## is running behind a reverse proxy. Do not configure it if you access
## Dashboard directly.
# public-path-prefix = "/dashboard"

## When enabled, request will be proxied to the instance running Dashboard
## internally instead of result in a 307 redirection.
# internal-proxy = false
Loading

0 comments on commit 2130d65

Please sign in to comment.