About keep_last

1 post / 0 new
Last seen: 7 years 11 months ago
Joined: 04/14/2016
Posts: 3
About keep_last


I am using RTI DDS version 5.1. And I create a DataWriter with qos: history.kind == KEEP_ALL, resource_limits in default value(unlimited). Let the DataWriter write same instance sample periodic. Also, I create a DataReader with qos history.kind == KEEP_LAST, and resource_limit.max_instace == 1, resource_limit.max_samples == 32, resource_limit.max_samples_per_instance == 32, and set the listener with mask == REJECT_STATUS_MASK. I create a thread to read the data on the datareader, and print the result sample number.

I observed the following phenomenon:

  • the print result in DataReader increasing from 1 to 32, normal;
  • then on_sample_reject is ivoked, which means RTI DDS rejected a sample, In my opinion, only if I set the history.kind == KEEP_ALL, some sample will rejected because of the limit of the resource_limit, when history == KEEP_LAST, DDS would never rejected samples, this is the first question.
  • and then the print number roll back to 3 or a little bigger and increasing to 32, which means almost all sample was delete from the history, In my opinion, when I set the history.kind == KEEP_LAST, when the sample is enough, RTI DDS should keep as many samples as the history.depth, this is my second question.

can any one expains this phenomenon to me?