fix: TAP-10529 inaccurate statistics of output indicators in share cd…#3091
fix: TAP-10529 inaccurate statistics of output indicators in share cd…#3091mnianqi wants to merge 1 commit intorelease-v4.13.0from
Conversation
🤖 Augment PR SummarySummary: This PR adjusts how observable metric handlers are managed in order to address inaccurate output indicator statistics in shared CDC tasks. Changes:
Technical Notes: The handler map lifecycle is now dependent on which aspects are actually observed during a task run, which affects when these maps may be null. 🤖 Was this summary useful? React with 👍 or 👎 |
| private final Map<String, TableSampleHandler> tableSampleHandlers = new ConcurrentHashMap<>(); | ||
| private final Map<String, DataNodeSampleHandler> dataNodeSampleHandlers = new ConcurrentHashMap<>(); | ||
| private final Map<String, ProcessorNodeSampleHandler> processorNodeSampleHandlers = new ConcurrentHashMap<>(); | ||
| private Map<String, TableSampleHandler> tableSampleHandlers; |
There was a problem hiding this comment.
Since tableSampleHandlers now starts as null, any direct dereference can throw NPE (e.g. handleSnapshotWriteTableCompleteFunc uses tableSampleHandlers::get when sourceTableName is non-null). This seems reachable if table-count/handler initialization never happened for a run but snapshot completion still fires.
Severity: high
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| private final Map<String, DataNodeSampleHandler> dataNodeSampleHandlers = new ConcurrentHashMap<>(); | ||
| private final Map<String, ProcessorNodeSampleHandler> processorNodeSampleHandlers = new ConcurrentHashMap<>(); | ||
| private Map<String, TableSampleHandler> tableSampleHandlers; | ||
| private Map<String, DataNodeSampleHandler> dataNodeSampleHandlers; |
There was a problem hiding this comment.
With dataNodeSampleHandlers now nullable, several handlers still call dataNodeSampleHandlers.get(...) without a prior null-check (e.g. handleBatchSize, handleDataNodeClose). If any of those aspects can occur before handleDataNodeInit (or in flows where init isn’t observed), this will NPE.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| private final Map<String, ProcessorNodeSampleHandler> processorNodeSampleHandlers = new ConcurrentHashMap<>(); | ||
| private Map<String, TableSampleHandler> tableSampleHandlers; | ||
| private Map<String, DataNodeSampleHandler> dataNodeSampleHandlers; | ||
| private Map<String, ProcessorNodeSampleHandler> processorNodeSampleHandlers; |
There was a problem hiding this comment.
processorNodeSampleHandlers is now nullable, but handleProcessorNodeClose/handleProcessorNodeProcess dereference it via processorNodeSampleHandlers.get(nodeId) without guarding for null. If close/process aspects can be emitted without a prior init being observed, this will NPE.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
…c task