I am using rti dds version 6.0.0
How can I delete an instance from persistence services history?
I know if I dispose instance with data writer that published last sample, it will delete from persistence history if it was in keep_history_last. But I want delete last sample from persistence services history after reboot computer, when I create new data writers and data readers
The Persistence Service must receive a Disposed sample for the instance to remove the history of the instance from persistence storage.
So, you pretty much have to call Dispose on a DataWriter for the instance that you want to dispose. So, when you create the new DataWriter, you need to call dispose() with the instance that you are disposing. If that isn't working, you may need to first send a dummy sample with the new DataWriter and then call dispose().
Finally, if there is a reasonable lifespan for a sample, you can use the Lifespan QoS to have Persistence Service automatically remove expired samples.
Yes, that's why I suggest that you have your datawriter app send a "dummy" sample before calling dispose()...so that it will be the datawriter that sent the last sample for the instance. But your way can also work...the issue is if you are using a virtual GUID, your seq no must be > than the last seq no sent using the virtual GUID...or else the sample will be dropped as an old sample.
Thanks for your help.
Oh, something that might work without you having to send a dummy data sample for an instance that a new writer wants to dispose...you can try setting this QoS:
The documentation is here:
https://community.rti.com/static/documentation/connext-dds/7.3.0/doc/api/connext_dds/api_cpp/structDDS__DataWriterProtocolQosPolicy.html#a7d8c1e77cbcf49d4b993d2e567c6468a
Dispose is only defined with respect to instances and thus keyed topics. What is your use case such that you want to dispose a non-keyed topic?
Sorry to say, that for non-keyed topics, there is no way to command or otherwise stimulate the Persistence Service to drop data for the non-keyed topic in its cache (aka history queue).
The only way that data is removed from the history queue is if
1) it's overwritten by new data with a finite history, the queue is used as a round robin queue
or
2) DataWriters sending the data are confgured with LifeSpan QoS such that the data has a limited lifetime after sending. Persistence Service will remove the data once its lifespan has expired.
https://community.rti.com/static/documentation/connext-dds/current/doc/api/connext_dds/api_cpp/structDDS__LifespanQosPolicy.html