Introduce support for liveness check for MySQL CDC listener#1428
Introduce support for liveness check for MySQL CDC listener#1428gayaldassanayake merged 7 commits intoballerina-platform:masterfrom
Conversation
📝 WalkthroughWalkthroughBumps package and native/plugin versions to 1.16.2, expands Dependencies.toml with new/updated packages (Avro, Confluent, Kafka, updated mysql and CDC entries), changes CdcListener config type from map to map and adds livenessInterval, and adds listener liveness tests. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@ballerina/cdc_listener.bal`:
- Around line 22-24: The fields isStarted and hasAttachedService in the cdc
listener object are declared but never referenced; remove the unused boolean
fields isStarted and hasAttachedService from the object/record declaration in
cdc_listener.bal (the declarations "private boolean isStarted = false;" and
"private boolean hasAttachedService = false;") so the type no longer contains
dead fields, and run tests/compile to confirm no remaining references; no other
code changes are required if there are truly no usages.
🧹 Nitpick comments (2)
ballerina/tests/listener_liveness_test.bal (2)
85-103: Consider potential test flakiness due to timing dependency.This test relies on
runtime:sleep(10)exceeding thelivenessInterval: 5.0to trigger a liveness failure. In CI environments under load, timing-based tests can be flaky. Consider:
- Increasing the margin between sleep duration and interval (e.g., sleep 15s with 5s interval).
- Adding a retry mechanism or documenting the timing assumptions.
24-38: Consider adding cleanup in error scenarios.If
mysqlListener.attachfails, the test exits without cleanup. While this specific test doesn't callstart(), establishing a pattern of usingdeferor try-finally for listener cleanup would improve robustness across all liveness tests.
| private final map<anydata> & readonly config; | ||
| private boolean isStarted = false; | ||
| private boolean hasAttachedService = false; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for usages of isStarted and hasAttachedService in .bal files
rg -n 'isStarted|hasAttachedService' --type-add 'bal:*.bal' --type balRepository: ballerina-platform/module-ballerinax-mysql
Length of output: 232
Remove unused fields isStarted and hasAttachedService.
These fields are declared at lines 23-24 but never used anywhere in the codebase. No assignments or references to these fields exist outside of their initial declarations, indicating they are dead code and should be removed.
🤖 Prompt for AI Agents
In `@ballerina/cdc_listener.bal` around lines 22 - 24, The fields isStarted and
hasAttachedService in the cdc listener object are declared but never referenced;
remove the unused boolean fields isStarted and hasAttachedService from the
object/record declaration in cdc_listener.bal (the declarations "private boolean
isStarted = false;" and "private boolean hasAttachedService = false;") so the
type no longer contains dead fields, and run tests/compile to confirm no
remaining references; no other code changes are required if there are truly no
usages.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@ballerina/Dependencies.toml`:
- Around line 52-56: Update gradle.properties so its stdlib module versions
exactly match Dependencies.toml: set crypto=2.10.1, data.jsondata=1.1.3,
http=2.14.9, jwt=2.15.1, mime=2.12.1, oauth2=2.14.1, os=1.10.1, time=2.8.0, and
url=2.6.1; also add the missing module entry present in Dependencies.toml that
uses version 1.5.1 (the module listed with 1.5.1 in Dependencies.toml) so every
module/version pair in Dependencies.toml has a corresponding entry in
gradle.properties (mysql can be left as-is at 1.16.2).
| [[package]] | ||
| org = "ballerina" | ||
| name = "crypto" | ||
| version = "2.9.0" | ||
| version = "2.10.1" | ||
| dependencies = [ |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Compare stdlib versions between gradle.properties and Dependencies.toml.
echo "=== Searching for stdlib versions in gradle.properties ==="
rg -n 'stdlib(Crypto|DataJsonData|Http|Jwt|Mime|OAuth2|Observe|Os|Time|Url)Version' gradle.properties
echo ""
echo "=== Searching for stdlib module names and versions in Dependencies.toml ==="
rg -n -C1 'name = "(crypto|data.jsondata|http|jwt|mime|oauth2|observe|os|time|url)"' ballerina/Dependencies.toml
echo ""
echo "=== Checking mysql module version alignment ==="
rg -n 'name = "mysql"|version = "1\.16\.2"' ballerina/Dependencies.toml ballerina/Ballerina.tomlRepository: ballerina-platform/module-ballerinax-mysql
Length of output: 4933
Version misalignments detected between gradle.properties and Dependencies.toml.
All stdlib module versions in Dependencies.toml exceed those specified in gradle.properties:
- crypto: 2.10.1 vs 2.9.0
- data.jsondata: 1.1.3 vs 1.1.0
- http: 2.14.9 vs 2.14.0
- jwt: 2.15.1 vs 2.15.0
- mime: 2.12.1 vs 2.12.0
- oauth2: 2.14.1 vs 2.14.0
- os: 1.10.1 vs 1.10.0
- time: 2.8.0 vs 2.7.0
- url: 2.6.1 vs 2.6.0
Additionally, observe (1.5.1) appears in Dependencies.toml but has no corresponding entry in gradle.properties. The mysql module is correctly aligned at 1.16.2 in both files. Update gradle.properties to match Dependencies.toml versions to prevent build conflicts.
🤖 Prompt for AI Agents
In `@ballerina/Dependencies.toml` around lines 52 - 56, Update gradle.properties
so its stdlib module versions exactly match Dependencies.toml: set
crypto=2.10.1, data.jsondata=1.1.3, http=2.14.9, jwt=2.15.1, mime=2.12.1,
oauth2=2.14.1, os=1.10.1, time=2.8.0, and url=2.6.1; also add the missing module
entry present in Dependencies.toml that uses version 1.5.1 (the module listed
with 1.5.1 in Dependencies.toml) so every module/version pair in
Dependencies.toml has a corresponding entry in gradle.properties (mysql can be
left as-is at 1.16.2).
439ed64
into
ballerina-platform:master
Purpose
Part of: ballerina-platform/ballerina-library#8589
Checklist
Summary
This pull request adds liveness-check support to the MySQL CDC listener to enable runtime health checks for CDC connections and improve listener reliability monitoring.
Key Changes
Listener configuration and behavior
Tests
Dependency and packaging updates
Impact
Applications and operators can now detect unresponsive MySQL CDC listeners via the liveness check. The configuration type change enables richer configuration values to be carried in the listener config. New tests validate the liveness behavior and dependency updates align native/tooling artifacts with these changes.