Skip to content

feat: support check conn liveness#260

Merged
dk-lockdown merged 1 commit into
CECTC:devfrom
dk-lockdown:feat/conn_check
Aug 29, 2022
Merged

feat: support check conn liveness#260
dk-lockdown merged 1 commit into
CECTC:devfrom
dk-lockdown:feat/conn_check

Conversation

@dk-lockdown
Copy link
Copy Markdown
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
Copy Markdown

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

Comment thread pkg/mysql/conn.go

sysConn, ok := conn.(syscall.Conn)
if !ok {
return nil
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

4 participants