wybaby168 opened a new pull request, #11872:
URL: https://github.com/apache/seatunnel/pull/11872
### Purpose of this pull request
Fixes #9533.
RabbitMQ checkpoints written by released SeaTunnel versions before the
split-enumerator state fix contain `RabbitmqSourceState`, while the current
source declares `RabbitmqSplitEnumeratorState`. During restore, the generated
bridge method casts the deserialized state before invoking `restoreEnumerator`,
which causes:
`RabbitmqSourceState cannot be cast to RabbitmqSplitEnumeratorState`
This patch preserves the legacy class's original `serialVersionUID` and
makes it a compatibility subtype of `RabbitmqSplitEnumeratorState`. Because the
legacy state did not contain assigned-split data, its compatibility constructor
uses an empty assignment map. New checkpoints continue to use
`RabbitmqSplitEnumeratorState`.
The regression test embeds checkpoint state serialized by SeaTunnel 2.3.13,
deserializes it with the current code, and restores the current enumerator from
it.
### Does this PR introduce _any_ user-facing change?
Yes. Streaming jobs using the RabbitMQ source can restore checkpoints
created by older connector versions instead of failing with
`ClassCastException`. New checkpoint behavior and connector configuration are
unchanged.
### How was this patch tested?
- Built the required reactor modules with Java 8:
`./mvnw -pl seatunnel-connectors-v2/connector-rabbitmq -am -DskipTests
install`
- Ran the complete RabbitMQ connector test suite:
`./mvnw -pl seatunnel-connectors-v2/connector-rabbitmq test`
- Result: 26 tests, 0 failures, 0 errors, 0 skipped.
- Added `testRestoreLegacySourceState`, which deserializes a real 2.3.13
checkpoint-state fixture and restores the current split enumerator.
### Check list
* [x] No new Jar binary package is added.
* [x] Documentation changes are not required because this restores
checkpoint compatibility without changing configuration.
* [x] `incompatible-changes.md` does not need an update because this removes
an incompatibility.
* [x] Connector registration and distribution files do not change because
this is an internal state compatibility 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]