Hi all, I'd like to start a discussion on PIP-506, a sub-PIP of PIP-460 (Scalable Topics):
https://github.com/apache/pulsar/pull/27839 Problem On a scalable topic, message deduplication does not cover the messages that are in flight when a split, a merge or a rebucket seals their segment. The producer cannot tell which of its unacknowledged messages the sealed segment stored, so it sends all of them again, and the successor stores them a second time: it has an empty deduplication state, and the messages arrive under another producer name and other sequence IDs. The application gets no error. A test that loses the receipts on purpose ends with 110 messages stored where 80 were sent, with deduplication enabled. Proposal 1. When the controller has sealed the sources of a layout change, and before it publishes the new layout, it hands their deduplication state to the successors. A producer has another name on each segment, so nothing has to be merged, also for a merge. The sealed segments are not needed afterwards: the data retention of the topic keeps deciding alone when they are deleted. 2. Before a producer sends its unacknowledged messages again, it asks a successor for the last sequence ID stored under the name it had on the sealed segment (a new CommandGetLastSequenceId), and sends only what is above it. There is no new configuration, nothing changes while deduplication is disabled, and a layout change behaves as today wherever a broker or client without the feature is involved. The client behavior goes into the scalable topics client specification as an Experimental capability, per PIP-494. Out of scope: replaying messages with application-chosen sequence IDs after a restart (effectively-once sources), and the cutover of a regular-to-scalable migration. A prototype was tested for splits, merges, rebuckets and combinations of them, with the sealed segments kept and deleted; the PIP lists the results. Feedback is welcome, in particular on: - replaying the layout change when the hand-over fails, rather than completing it without the state; - the new command, against asking by attaching a producer with the old name; - keeping what a segment took over in the snapshot of its deduplication state. Thanks, Penghui
