Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

*: refine context usage to avoid potential blocks (#1285) #1293

Merged
merged 1 commit into from
Nov 23, 2020

Conversation

ti-srebot
Copy link

cherry-pick #1285 to release-2.0


What problem does this PR solve?

refine context usage to avoid potential blocks, like:

fix #1279

What is changed and how it works?

add context for DB operations.

some suggestions for later dev:

  • always try to use QueryContext/ExecContext rather than Query/Exec for DB operations
  • try to avoid using context.Background for most cases except in testing code
  • combine context.Context and logger into a tcontext.Context may be not a good idea, becase context.Context often takes effect in a single process workflow but logger often takes effect in a whole component
  • some tcontext.Context may still need to be refined later

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change
  • Has interface methods change

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated priority/normal Minor change, requires approval from ≥1 primary reviewer status/PTAL This PR is ready for review. Add this label back after committing new changes type/bug-fix Bug fix type/cherry-pick This PR is just a cherry-pick (backport) first-time-contributor labels Nov 23, 2020
@lance6716
Copy link
Collaborator

/run-all-tests

[2020-11-23T02:01:29.365Z] go: github.com/mattn/goveralls@v0.0.4: reading http://goproxy.pingcap.net/github.com/mattn/goveralls/@v/v0.0.4.mod: 504 Gateway Time-out

@csuzhangxc csuzhangxc added this to the v2.0.1 milestone Nov 23, 2020
@csuzhangxc
Copy link
Member

/run-compatibility-test

Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csuzhangxc csuzhangxc added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Nov 23, 2020
@csuzhangxc csuzhangxc merged commit 13191a8 into pingcap:release-2.0 Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
first-time-contributor needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT1 One reviewer already commented LGTM type/bug-fix Bug fix type/cherry-pick This PR is just a cherry-pick (backport)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants