Skip to content

feat: supports adapter high availability#117

Merged
guanshengliang merged 33 commits into
mainfrom
feat/6665270968
Jun 1, 2026
Merged

feat: supports adapter high availability#117
guanshengliang merged 33 commits into
mainfrom
feat/6665270968

Conversation

@qevolg

@qevolg qevolg commented May 20, 2026

Copy link
Copy Markdown
Contributor

Description

feat: supports adapter high availability

Issue(s)

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a design specification document describing how the Node.js connector would implement Adapter high availability (HA) via dynamic instance discovery (list_instances) during initial SQL connect / TMQ subscribe, and how newly discovered endpoints are merged into the DSN address pool.

Changes:

  • Introduces a new spec outlining the adapter_ha DSN parameter and the list_instances request/response fields.
  • Describes intended code changes (DSN merge, wsClient/wsTmq message building) and a proposed test plan.
Comments suppressed due to low confidence (3)

docs/specs/2026-05-20-adapter-ha-design.md:45

  • 本仓库 Node.js 实现位于 nodejs/src/...(例如 nodejs/src/common/dsn.ts),这里从 ## 变更文件 开始使用的 src/... 路径与实际目录结构不一致,容易误导后续实现/评审。建议将这些路径统一改为 nodejs/src/...(下文的 wsClient.ts / wsTmq.ts 同理)。
## 变更文件

### `src/common/dsn.ts`

docs/specs/2026-05-20-adapter-ha-design.md:152

  • 测试文件路径目前在仓库中是 nodejs/test/...(例如存在 nodejs/test/common/),这里写的 test/common/adapter-ha.test.ts 与现有目录结构不一致。建议更新为实际/计划落地的路径,避免后续按文档找不到测试用例。
## 测试

### 单元测试 — `test/common/adapter-ha.test.ts`

docs/specs/2026-05-20-adapter-ha-design.md:164

  • test/bulkPulling/adapter-ha.test.ts 目录在当前仓库中不存在(未找到 bulkPulling 相关测试目录)。建议改成现有测试结构下的目标位置(例如 nodejs/test/...),或在实现阶段明确创建对应目录与命名规则。
- `buildSubscribeMessage()` 中 `list_instances` 字段的生成验证

### 集成测试 — `test/bulkPulling/adapter-ha.test.ts`


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/specs/2026-05-20-adapter-ha-design.md Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a design specification for implementing Adapter High Availability (HA) in the Node.js connector, allowing for dynamic instance discovery via the list_instances protocol field. The feedback suggests enhancing the robustness of the HA support by considering a periodic refresh strategy for the instance list to handle cluster topology changes over time. Additionally, a suggestion was made to improve the clarity of the design document by avoiding non-null assertion operators in pseudo-code.

Comment thread docs/specs/2026-05-20-adapter-ha-design.md Outdated
Comment thread docs/specs/2026-05-20-adapter-ha-design.md Outdated
@codecov-commenter

codecov-commenter commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.07%. Comparing base (a83dce0) to head (3d9eaed).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #117      +/-   ##
==========================================
+ Coverage   81.67%   82.07%   +0.40%     
==========================================
  Files          33       34       +1     
  Lines        3356     3515     +159     
  Branches      623      660      +37     
==========================================
+ Hits         2741     2885     +144     
- Misses        465      479      +14     
- Partials      150      151       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI review requested due to automatic review settings May 26, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread nodejs/package.json
Comment thread nodejs/package.json Outdated
Comment thread docs/specs/2026-05-20-adapter-ha-design.md Outdated
Comment thread docs/specs/2026-05-20-adapter-ha-design.md Outdated
Comment thread blog-nodejs-load-balancing-failover.md Outdated
Copilot AI review requested due to automatic review settings May 27, 2026 08:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread blog-nodejs-load-balancing-failover.md Outdated
Comment thread blog-nodejs-failover-full.md Outdated
qevolg and others added 6 commits May 27, 2026 17:35
Reference: taos-connector-jdbc PR #321

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Addresses 6 review findings:
1. Separate _failoverAddresses from _dsn.addresses to preserve pool key invariant
2. ClusterRegistry uses deep copy + Object.freeze for immutability
3. Add discovery lifecycle and topology refresh semantics section
4. Document merge-then-register ordering and failure semantics
5. Specify endpoint format contract (IPv4/IPv6 parsing rules)
6. Add multi-discovery and cross-path test scenarios

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1. Clarify ClusterRegistry scope as per-event-loop singleton (not cross-worker)
2. Add multi-cluster seed detection with warn + reject expansion
3. Add pool key invariance test case and multi-cluster detection test case

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 27, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread .github/workflows/build.yml
Comment thread nodejs/src/client/clusterRegistry.ts
Comment thread nodejs/src/client/wsConnector.ts Outdated
Comment thread nodejs/test/client/wsConnector.adapterHa.test.ts
qevolg and others added 2 commits May 28, 2026 11:07
Introduce Cluster class to replace raw Address[] in ClusterRegistry,
use cluster UUID as pool key for adapter HA connections.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
getOrCreateCluster returns null when seeds span multiple clusters,
getPoolKey falls back to address concatenation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread nodejs/src/client/wsConnector.ts
Comment thread .github/workflows/build.yml
Copilot AI review requested due to automatic review settings May 28, 2026 11:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread nodejs/src/client/wsConnector.ts
Copilot AI review requested due to automatic review settings May 28, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread nodejs/src/client/clusterRegistry.ts Outdated
Comment thread nodejs/package.json Outdated
Comment thread nodejs/src/client/wsConnector.ts
@qevolg qevolg changed the title docs: add adapter HA support design spec feat: supports adapter high availability May 29, 2026
Copilot AI review requested due to automatic review settings May 29, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread nodejs/src/client/wsConnector.ts
Comment thread nodejs/package-lock.json Outdated
Copilot AI review requested due to automatic review settings May 29, 2026 01:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

Comment thread nodejs/src/client/wsConnector.ts
@guanshengliang guanshengliang merged commit 6b1abd2 into main Jun 1, 2026
9 checks passed
@guanshengliang guanshengliang deleted the feat/6665270968 branch June 1, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants