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

feat: support check conn liveness #260

Merged
merged 1 commit into from
Aug 29, 2022

Conversation

dk-lockdown
Copy link
Collaborator

ref: https://github.com/cectc/dbpack/issues/

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@dk-lockdown dk-lockdown marked this pull request as ready for review August 23, 2022 16:09
@codecov-commenter
Copy link

Codecov Report

Merging #260 (3f65f05) into dev (5caeb6c) will increase coverage by 0.64%.
The diff coverage is 35.71%.

❗ Current head 3f65f05 differs from pull request most recent head c632ca0. Consider uploading reports for the commit c632ca0 to get more accurate results

@@            Coverage Diff             @@
##              dev     #260      +/-   ##
==========================================
+ Coverage   43.12%   43.77%   +0.64%     
==========================================
  Files          82       82              
  Lines        9845     9885      +40     
==========================================
+ Hits         4246     4327      +81     
+ Misses       5164     5106      -58     
- Partials      435      452      +17     
Impacted Files Coverage Δ
pkg/driver/client.go 0.00% <0.00%> (ø)
pkg/optimize/optimize_select.go 69.01% <0.00%> (-6.38%) ⬇️
pkg/optimize/optimizer.go 40.00% <0.00%> (-4.45%) ⬇️
pkg/plan/query.go 36.46% <10.00%> (-4.03%) ⬇️
pkg/executor/sharding.go 46.38% <88.23%> (+46.38%) ⬆️
pkg/plan/delete.go 7.27% <100.00%> (ø)
pkg/plan/insert.go 50.00% <100.00%> (ø)
pkg/plan/update.go 10.52% <100.00%> (ø)
pkg/executor/misc.go 90.00% <0.00%> (+20.00%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


sysConn, ok := conn.(syscall.Conn)
if !ok {
return nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

better to return error instead of nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only syscall.Conn SyscallConn() func return RawConn, we use RawConn to check connection alive. If a connection is't syscall.Conn does't mean it can't read.

Copy link
Collaborator

@bohehe bohehe left a comment

Choose a reason for hiding this comment

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

LGTM

@dk-lockdown dk-lockdown merged commit 59b9ff1 into CECTC:dev Aug 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants