About pruning domain

Hi team,

I would like to explore more the behaviour after pruning is done on domain database (assuming a PostgresDB domain).

My understanding is that, after daml transaction is committed in participant nodes (and contract states are updated) the whole daml transaction is complete. We can prune the domain without any impacts on the participant nodes. See if my understanding is correct or something missing.

Any drawback if we keep pruning the domain (to keep almost minimal on the database)? One point in my mind is that we cannot recover the participant node from the domain when needed. But I think the participant node should be recovered from its persistent database rather than from the domain. See if my understanding is correct.

Thanks.

kc

Hi @kctam

Yes, your understanding is correct. You can prune the domain continuously. The only caveat is that the pruning window should be larger than the participant database backup window. So if you prune everything that is older than 7 days, then make sure that you run a daily backup of your participants so that you can recover them in case of a disaster affecting your participant database, as the participants will then still be able to replay the messages that were processed between the backup and the disaster.

So the pruning frequency of the domain depends on the backup frequency of your participant. You could e.g. employ continuous archiving: PostgreSQL: Documentation: 14: 26.3. Continuous Archiving and Point-in-Time Recovery (PITR)

Generally, the domain does not store contracts or state. It just stores “ordered end-to-end encrypted messages for the purpose of guaranteed delivery”. So everything, where you are absolutely sure that you won’t have to replay, can be pruned.

I hope this helps.
Ratko

2 Likes