Blue/Green plugin has no effect on cluster endpoint connections
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- aws, mysql, node.js, typescript
调研方向
Start with collectTopology() in blue_green_status_monitor.ts and isMatch in routing/base_connect_routing.ts and routing/base_execute_routing.ts; compare how the Python and JDBC wrappers retain cluster endpoints. Then check the bg imports in blue_green_plugin.ts against UsingTheBlueGreenPlugin.md for the dependency note. Done means cluster endpoint connections are suspended and routed to the green IP during switchover, with the required dependencies documented; investigate the reported delay in detecting IN_PROGRESS separately.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
With plugins: "bg" and the cluster writer endpoint, the plugin neither suspends calls during switchover nor reconnects to the green IP. Downtime is the same as plain mysql2. Two defects, plus a missing dependency note:
1. Cluster endpoints are dropped from hostNames
blue_green_status_monitor.ts L311: collectTopology() replaces the set that collectStatus() filled with cluster endpoints (~L377/L404):
this.hostNames = new Set(currentTopologyCopy.map((hostSpec) => hostSpec.host));
roleByHost then contains instance endpoints only, so connections via the cluster endpoint get no role and are not handled. JDBC (addAll) and Python (update) add to the set instead.
2. isMatch compares a string with an object
routing/base_connect_routing.ts L28 and base_execute_routing.ts L27:
this.hostAndPort === (hostInfo ?? hostInfo.hostAndPort.toLowerCase())
hostInfo ?? ... returns the HostInfo object, so this is always false and endpoint-specific routings (e.g. SubstituteConnectRouting) never apply.
3. Undocumented dependencies
bg fails to load unless both @aws-sdk/credential-providers and @aws-sdk/rds-signer are installed (blue_green_plugin.ts L26 imports IamAuthenticationPlugin). UsingTheBlueGreenPlugin.md doesn't mention this. Similar class of issue to #515, different dependency chain.
AwsWrapperError: The plugin could not be imported due to error 'Cannot find package '@aws-sdk/credential-providers' ...' Plugin: 'BlueGreenPluginFactory'
Expected Behavior
Calls via the cluster endpoint are suspended during IN_PROGRESS and reconnect to the green IP, as with the JDBC wrapper (~3.9 s write downtime in the same test).
What plugins are used? What other connection properties were set?
plugins: "bg", dialect: "aurora-mysql", clusterId: , ssl: { ca }, wrapperConnectTimeout: 10000, wrapperQueryTimeout: 10000, host = cluster writer endpoint (AwsMySQLClient, mysql2 3.22.3). Also with plugins: "initialConnection,auroraConnectionTracker,bg,failover2"
Current Behavior
- Original 3.0.1:
roleByHostlists 4 instance endpoints only (Python wrapper in the same environment: 8 incl. cluster endpoints). Calls get--read-onlyerrors like plain mysql2. Write downtime ~24.6 s vs ~21.9 s plain mysql2. - With fix 1 only: cluster endpoints present (8 entries), still ~24.8 s (reconnect waits for DNS).
- With fixes 1+2: ~5.3 s.
- Note: Node.js detected
IN_PROGRESS~1.1-1.7 s later than the Python/JDBC wrappers in the same switchover, so a few--read-onlyerrors still occur before suspension. Cause not investigated.
Reproduction Steps
- Aurora MySQL cluster + Blue/Green deployment (same version), wait for
AVAILABLE. - Write every 100 ms:
import { AwsMySQLClient } from "aws-advanced-nodejs-wrapper/mysql";
const client = new AwsMySQLClient({ host: "<cluster-endpoint>", user, password, database: "test", ssl: { ca },
plugins: "bg", dialect: "aurora-mysql", wrapperConnectTimeout: 10000, wrapperQueryTimeout: 10000 });
await client.connect();
setInterval(async () => { try { await client.query("INSERT INTO t(v) VALUES (1)"); console.log(Date.now()); } catch (e) { console.log(e.message); } }, 100);
- After the plugin logs
CREATED(LOG_LEVEL=debug), start the switchover. CheckroleByHostand the write gap.
Possible Solution
// blue_green_status_monitor.ts
- this.hostNames = new Set(currentTopologyCopy.map((hostSpec) => hostSpec.host));
+ currentTopologyCopy.forEach((hostSpec) => this.hostNames.add(hostSpec.host));
// base_connect_routing.ts, base_execute_routing.ts
- this.hostAndPort === (hostInfo ?? hostInfo.hostAndPort.toLowerCase())
+ this.hostAndPort === (hostInfo?.hostAndPort.toLowerCase() ?? null)
Also document (or avoid statically importing) the two @aws-sdk/* dependencies for bg.
Additional Information/Context
Aurora MySQL 8.4.10, db.r8g.large x2, same-version Blue/Green deployment.
The AWS Advanced NodeJs Wrapper version used
3.0.1
Node version used
v22.23.4
Operating System and version
Amazon Linux 2023 (aarch64)
- 主要语言
- TypeScript
- 星标
- 38
- 派生
- 17
- 平均合并
- 3 天 11 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-advanced-nodejs-wrapper 的其他 Issue
-
bug
难度 4/5 3-5 天 新手友好度 45/100
aws/aws-advanced-nodejs-wrapper#717 · 2 条评论 ·
维护者通常 2 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 65/100
aws/aws-advanced-nodejs-wrapper#527 · 7 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
查看 aws/aws-advanced-nodejs-wrapper 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
pending close triaging
难度 2/5 1-3 小时 新手友好度 78/100
anomalyco/opencode#62582 · 1 条评论 ·
维护者通常 1 天内回复
-
feature request
难度 2/5 1-3 小时 新手友好度 72/100
callstack/react-native-paper#5189 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
live-codes/livecodes#1079 · 1 条评论 ·
维护者通常 1 天内回复
-
Add: ESP 2 RO未关闭approved check:passed streams:add
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复