Observations after pruning

Hi team,
I am testing the ledger pruning, using a sample canton setup, using the code in Operational Processes — Daml SDK 2.2.0 documentation and it works after tuning some timers (max deduplication, etc). From the log I see the pruning seems working well. (some lines from the log are shown here)

2022-05-19 15:45:32,759 [daml.index.db.threadpool.connection.api-server-2] INFO  c.d.p.s.b.h2.H2EventStorageBackend - Immediate divulgence events pruning finished: deleted 1 rows., context: {participant: "participant2", submissionId: "7cc0c31f-b641-4a13-87e6-6579f647e643"}
2022-05-19 15:45:32,759 [daml.index.db.threadpool.connection.api-server-2] INFO  c.d.p.s.b.h2.H2EventStorageBackend - Exercise (consuming) events pruning finished: deleted 1 rows., context: {participant: "participant2", submissionId: "7cc0c31f-b641-4a13-87e6-6579f647e643"}
2022-05-19 15:45:32,760 [daml.index.db.threadpool.connection.api-server-2] INFO  c.d.p.s.b.h2.H2EventStorageBackend - Exercise (non-consuming) events pruning finished: deleted 0 rows., context: {participant: "participant2", submissionId: "7cc0c31f-b641-4a13-87e6-6579f647e643"}
2022-05-19 15:45:32,760 [daml.index.db.threadpool.connection.api-server-2] INFO  c.d.p.s.b.c.CompletionStorageBackendTemplate - Command completions pruning finished: deleted 1 rows., context: {participant: "participant2", submissionId: "7cc0c31f-b641-4a13-87e6-6579f647e643"}

However, after the pruning is done, the navigator can no longer show any active contracts. Besides, the grpcurl I was using for dump transactions also gets some error message

grpcurl -plaintext -d '{"ledgerId":"participant2","filter":{"filtersByParty":{"Bob::1220e0acfc323885c6eb786ce652ea5d58e886c1cfff3e7337767dcfd7f7931eecc0":{}}},"begin":{"boundary":"LEDGER_BEGIN"}}' localhost:5021 com.daml.ledger.api.v1.TransactionService/GetTransactionTrees

ERROR:
  Code: FailedPrecondition
  Message: PARTICIPANT_PRUNED_DATA_ACCESSED(9,0): Transactions request from  to 00000000000000000a precedes pruned offset 000000000000000009
  Details:
  1)	{"@error":"google.rpc.ErrorInfo is not recognized; see @value for raw binary message data","@type":"type.googleapis.com/google.rpc.ErrorInfo","@value":"CiBQQVJUSUNJUEFOVF9QUlVORURfREFUQV9BQ0NFU1NFRBodCgtwYXJ0aWNpcGFudBIOJ3BhcnRpY2lwYW50MicaJQoPZWFybGllc3Rfb2Zmc2V0EhIwMDAwMDAwMDAwMDAwMDAwMDkaDQoIY2F0ZWdvcnkSATkaGAoPZGVmaW5pdGVfYW5zd2VyEgVmYWxzZQ=="}

Are these the normal behaviour? What is the best practice that shows the pruning of archived contracts are really gone?

Thanks in advance.
kc

Hi @kctam ,

However, after the pruning is done, the navigator can no longer show any active contracts.

Do you observe (in the Navigator) a decrease in the number of active contracts after you issue the pruning call?

Besides, the grpcurl I was using for dump transactions also gets some error message

With regard to the grpcurl call you are trying to make, please note that you must use a begin boundary that is at or after the offset at which the latest pruning call occurred. In your case, it would be at the offset indicated in the error message:

grpcurl -plaintext -d '{"ledgerId":"participant2","filter":{"filtersByParty":{"Bob::1220e0acfc323885c6eb786ce652ea5d58e886c1cfff3e7337767dcfd7f7931eecc0":{}}},"begin":{"absolute":"0000000000000009"}}' localhost:5021 com.daml.ledger.api.v1.TransactionService/GetTransactionTrees

What is the best practice that shows the pruning of archived contracts are really gone?

Validating this via the Ledger API is not possible, since all requests will return an error like the one you observed in case they target offsets before the last pruning offset.

The only way in which one can validate this is by inspecting the storage databases to check that the contract events are really gone after pruning.

Thanks @tudor_voicu ! Very useful information.

Regarding the Navigator output, it simply shows empty after I login as a user, not even the active contracts (which are still in the participant nodes as I see it with ledger_api.acs.ofAll() on canton console).

I will try the boundary using grpcurl.

Thanks again!

kc