Blue/Green plugin has no effect on cluster endpoint connections
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- aws, mysql, node.js, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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)
- Lenguaje dominante
- TypeScript
- Estrellas
- 38
- Forks
- 17
- Merge medio
- 3 d 11 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/aws-advanced-nodejs-wrapper
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
aws/aws-advanced-nodejs-wrapper#717 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
Exporting Typescript typesAbiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
aws/aws-advanced-nodejs-wrapper#527 · 7 comentarios · 1 reacción ·
Los mantenedores suelen responder en 2 días
Todos los issues de aws/aws-advanced-nodejs-wrapper
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
pending close triaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
anomalyco/opencode#62582 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
callstack/react-native-paper#5189 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
live-codes/livecodes#1079 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add: ESP 2 ROAbiertoapproved check:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día