You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org> on 2026/09/20 06:22:07 UTC

[PR] [Fix][Connector-V2] Make MqttSourceConfig serializable [seatunnel]

SEPURI-SAI-KRISHNA opened a new pull request, #12406:
URL: https://github.com/apache/seatunnel/pull/12406

   ### Purpose of this pull request
   
   Closes #12405, reported by @zixiao144.
   
   The MQTT source cannot be submitted to Zeta. `MqttSource` is a `SeaTunnelSource`, and `SeaTunnelSource` extends `Serializable` (`SeaTunnelSource.java:39`), but it holds a configuration object that is not:
   
   ```java
   public class MqttSource extends AbstractSingleSplitSource<SeaTunnelRow> {
       private final MqttSourceConfig sourceConfig;   // MqttSource.java:38
   ...
   public class MqttSourceConfig {                    // MqttSourceConfig.java:24, no Serializable
   ```
   
   Serializing the logical DAG therefore throws `NotSerializableException`, which Hazelcast reports as `Failed to serialize 'LogicalVertex'`. The job is rejected before the source starts.
   
   Every field of `MqttSourceConfig` is a `String`, `int` or `boolean`, so nothing about its contents was the problem. Only the class declaration was missing, and the fix is to add it along with a `serialVersionUID`.
   
   ### The sink is not affected, and I checked rather than assumed
   
   `MqttSink` holds `ReadonlyConfig`, `SeaTunnelRowType` and `CatalogTable`. All three implement `Serializable`, and the sink takes the configuration object directly instead of wrapping it. I round-tripped an `MqttSink` locally and it succeeds, so no change is needed there and none is made. That asymmetry, the sink using `ReadonlyConfig` while the source wraps it, is the whole reason only one side is broken.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in the sense that the MQTT source becomes usable on Zeta. It appears never to have worked there since the source was added in #10935 on 2026-06-08. No config option, default, or public API changes, and the sink is untouched.
   
   ### How was this patch tested?
   
   `./mvnw -q -DskipTests verify -pl seatunnel-connectors-v2/connector-mqtt` on JDK 11 passes, covering the enforcer checks, `spotless:check` and compilation. `spotless:check` was also run separately with up-to-date caching disabled.
   
   `./mvnw -pl seatunnel-connectors-v2/connector-mqtt test`: **32 tests, 0 failures, 0 errors**.
   
   The regression test is added to the existing `MqttSourceTest` rather than a new class. It writes an `MqttSource` through an `ObjectOutputStream` and reads it back, which needs no broker.
   
   It is a real regression test, not a passing formality. Against unmodified `dev` it fails:
   
   ```
   [ERROR] MqttSourceTest.testSourceIsJavaSerializable ยป NotSerializable
   java.io.NotSerializableException:
       org.apache.seatunnel.connectors.seatunnel.mqtt.source.MqttSourceConfig
   ```
   
   and with the one-line change it passes. That is the same before-and-after I used to confirm the diagnosis in the first place.
   
   ### On E2E coverage
   
   I want to flag this against the convention that a change in an area with an existing IT should update that IT, because the situation here is unusual.
   
   `connector-mqtt-e2e` exists, but it contains exactly one class, `MqttSinkIT`. There is no source IT. That absence is almost certainly why this shipped: the only end-to-end coverage exercises the side of the connector that works, so a source that cannot be submitted at all went unnoticed from #10935 in June until a user reported it.
   
   I have not added a source IT in this PR. The defect is Java serialization of the source object, which the unit test reproduces exactly and deterministically with no broker, and a source IT is a meaningful new piece of test infrastructure rather than an update to an existing one. I would rather land the one-line fix with a test that provably catches it than hold it behind new E2E scaffolding.
   
   That said, I think a source IT is worth having precisely because its absence hid this, and `MqttSinkIT` already stands up the broker container it would need. I am happy to open that as a follow-up, or to add it here if you would rather it came with the fix.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Make MqttSourceConfig serializable [seatunnel]

Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx merged PR #12406:
URL: https://github.com/apache/seatunnel/pull/12406


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Make MqttSourceConfig serializable [seatunnel]

Posted by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org>.
SEPURI-SAI-KRISHNA commented on PR #12406:
URL: https://github.com/apache/seatunnel/pull/12406#issuecomment-5748121334

   Two things I checked after opening this, worth stating rather than leaving for review.
   
   **A gap in the test I committed.** It serializes the source before `setJobContext` is called, while the engine sets the job context first. So the committed test does not exercise the production ordering. I verified that path separately with a throwaway test: a full config with `username`, `password` and `format`, `setJobContext(new JobContext().setJobMode(JobMode.STREAMING))`, then a round trip. It passes.
   
   I did not add that as a second test, because `JobContext` is `public final class JobContext implements Serializable` and `CatalogTable` is serializable too, so the ordering only exercises fields this PR does not change. The committed test targets the one field that was broken and fails without the fix. Happy to add the job-context variant if you would rather have the production ordering pinned as well.
   
   For completeness, those are all three fields on `MqttSource`: `MqttSourceConfig` (fixed here), `CatalogTable` and `JobContext`. `AbstractSingleSplitSource` declares none of its own, so nothing else on the source is unserializable.
   
   **Whether other connectors have the same defect.** They do not. I scanned every `*Source.java` under `seatunnel-connectors-v2` for fields typed `*Config`, `*Configuration` or `*Options`, resolved each of those types to its declaration, and checked for `Serializable`: 44 source-and-config pairs, and MQTT was the only one missing it. I sanity-checked the scan by confirming it flags `MqttSourceConfig` with the pre-fix declaration and stops flagging it with the fix, so the empty result is a real one rather than a query that matches nothing.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org