feat: enhance websocket connection and support stmt2 on Websocket#365
feat: enhance websocket connection and support stmt2 on Websocket#365
Conversation
…ment and message queuing
…skip incompatible cases
…rite-acked disconnect
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 121 out of 220 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 122 out of 228 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (2)
ws/client/conn.go:130
- ReadPump/WritePump dereference c.conn without guarding against nil. Since NewClient(nil, ...) is possible (and used in tests), calling pumps on such a client will panic. If nil connections are supported for test/placeholder clients, add early returns (or a clear error) at the beginning of ReadPump/WritePump when c.conn == nil.
func (c *Client) ReadPump() {
ws/client/conn.go:165
- ReadPump/WritePump dereference c.conn without guarding against nil. Since NewClient(nil, ...) is possible (and used in tests), calling pumps on such a client will panic. If nil connections are supported for test/placeholder clients, add early returns (or a clear error) at the beginning of ReadPump/WritePump when c.conn == nil.
func (c *Client) WritePump() {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SummaryThe core change introduces a new 🔴 Critical1.
|
| Priority | File | Action |
|---|---|---|
| P0 | common/stmt/mem.go + mem.s |
Delete; replace with binary.LittleEndian writes |
| P1 | ws/stmt/rows.go |
Document that NewRows now returns a non-functional Rows where Next() always returns io.EOF |
| P2 | taosWS/compat_write.go |
Add basic tests or document why none are needed |
| P2 | ws/unified/stmt.go Close |
Use s.client.runtimeClient() instead of s.runtime |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 125 out of 231 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bd8147c to
2eb9a64
Compare
…for new functions
2eb9a64 to
e162d28
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 127 out of 233 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…igurations and source files
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 127 out of 233 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 127 out of 233 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Point 1: common/stmt/mem.go — //go:linkname + no bounds checking ✅ Fixed.
Point 2: ws/stmt/rows.go — NewRows silent behavioral breaking change NewRows indeed no longer fetches row data — this is by design, not an oversight:
Point 4: Copy argument order is the reverse of Go convention ✅ Naturally resolved by Point 1 fix (for common/stmt). Copy(source, data, index, length) has been removed. The new functions copyUint32SliceToBytes(dest, source) / The Copy signature in common/parser is retained for external API compatibility and is out of scope for this PR. Point 5: ws/unified/stmt.go — Close uses a stale runtime snapshot ❌ Not a real issue. The current design is correct. Close() sets closed = true and captures stmtID under lock, then reads s.runtime after unlock. The reviewer's concern
|
zitsen
left a comment
There was a problem hiding this comment.
Code Review Summary
Reviewed: 233 files, 32K+ additions across ws/unified, stmt2, failover, CI workflows, and backward-compatible wrappers.
CI Status: All 20 checks passed ✅ (lint, ASAN, race detector, failover gate, reliability gate, multi-version Go tests)
Findings (non-blocking)
-
Medium – Potential race window in request-response sync (
ws/unified/request.go):
There is a timing window between releasingpendingLock(after registering a pending request) and callingruntime.Send(). IfswapRuntime()executes in this window, the send could go to a stale runtime. Consider verifying runtime generation afterSend()completes, or restructuring to ensure atomic registration+send under the same generation guarantee. The race detector CI passing suggests this is unlikely in practice, but worth hardening in a follow-up. -
Medium – Integer overflow risk in stmt2 binary marshalling (
common/stmt/stmt2.go):
The ~600-linemarshalStmt2BinaryWithHeaderperforms cumulativeuint32additions for buffer sizes. With many tables or large variable-length fields, these could theoretically overflow. Some bounds checks exist (e.g., table name length vsmath.MaxUint16), but comprehensive overflow protection for cumulative buffer size calculations would be a good hardening.
Verdict
No critical issues found. The architecture is solid — unified client with generation-based failover, proper mutex protection, and comprehensive CI coverage including ASAN and race detection. Approving.
Description
feat: enhance websocket connection and support stmt2 on Websocket
Issue(s)
Checklist
Please check the items in the checklist if applicable.