What are preemptive ACKNACK and preemptive heartbeat messages?
The DDS reliability protocol uses Heartbeat messages and ACKNACK messages to ensure the receipt of data. A DataReader sends an ACKNACK message in response to a DataWriter’s Heartbeat; this ACKNACK message indicates which samples the reader received, and which samples it has yet to receive. For detailed information about the DDS reliability protocol, see the Overview of the Reliable Protocol section of the Core Libraries User’s Manual.
In the steady-state, an ACKNACK must only be sent in response to a Heartbeat from a matched writer, but RTI Connext DDS has an optimization called the "preemptive ACKNACK" which breaks this pattern when a reader and writer first match. Upon discovering each other, a reader can send a preemptive ACKNACK to its newly matched writer before receiving any associated Heartbeat. This is a way of bootstrapping the discovery process, allowing the reader to get caught up with the writer’s state (i.e. current sequence number) quickly. Without preemptive ACKNACKs, the reader would need to wait for a Heartbeat from the matched writer. If the matched writer and reader are durable, this optimization may also cause the reader to receive late-joiner data faster than waiting for a Heartbeat and NACKing every sample. In Wireshark, a preemptive ACKNACK is dissected as shown in the figure below.
Figure 1. An example preemptive ACKNACK message in Wireshark 2.9
If the readerSNState's bitmapBase is set to 0, this indicates an ACKNACK is preemptive, and Wireshark’s RTPS dissector identifies these automatically at the bottom of the readerSNState section.
Preemptive Heartbeats are another RTI Connext DDS optimization intended to speed up discovery, but these Heartbeats currently aren’t labeled as “preemptive” by Wireshark’s RTPS dissector. This is because there's no internal state of the Heartbeat message itself that identifies it as preemptive or not. While the ACKNACK message has a bitmapBase which is set to 0 for preemptive ACKNACKs, the Heartbeat has no such distinguishing field. A preemptive heartbeat is simply a heartbeat sent immediately after a reader and writer match, rather than waiting for a periodic heartbeat to be sent. A preemptive Heartbeat may have any state at all, and is meant to communicate the writer’s state to a newly matched reader.