Manage persistence service history

5 posts / 0 new
Last post
Offline
Last seen: 1 week 4 days ago
Joined: 09/10/2022
Posts: 21
Manage persistence service history

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

Howard's picture
Offline
Last seen: 2 days 1 hour ago
Joined: 11/29/2012
Posts: 582

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.

 

Offline
Last seen: 1 week 4 days ago
Joined: 09/10/2022
Posts: 21
Thank you for your response. I found that only datawriter that sent the last sample of instance, can dispose instance and remove instance from persistences history, other datawriters can not remove sample from persistences history. And persistence stores and recognizes datawriters by their virtual_guid (a 16 length array of uint8_t), so I made a solution for my self. I make a unique virtual_guid for my durable datawriters automatically, so they can dispose any samples that they sent and remove it from persistences history. When I close my program and start it again or I restart the computer I generate that virtual_guid again in a logical way that gives the same virtual_guid. I just need to create a unique virtual_guid for durable datawriters.
Howard's picture
Offline
Last seen: 2 days 1 hour ago
Joined: 11/29/2012
Posts: 582

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.

Offline
Last seen: 1 week 4 days ago
Joined: 09/10/2022
Posts: 21

Thanks for your help.