> I came up with an alternate approach. In this approach we keep track
> of wal segment the transaction is part of. This helps to iterate
> through only required files during clean up.
>
> On my machine, I am running the testcase provided by you in [1]. It is
> generating ~1.9 million spill files. For me the transaction completed
> in 56sec.
> Cleanup (deletion of spill files) took around following time:
> With HEAD : ~ 5min
> With latest patch (attached here) : ~2min
>
> Can you test if this improves performance for you?
>
> The patch applies on HEAD.
Thanks again for this new patch.
Unfortunately it does not compile (17.2 source):
reorderbuffer.c: In function 'ReorderBufferSerializeTXN':
reorderbuffer.c:3771:72: error: passing argument 2 of 'lappend' makes pointer from integer without a cast
[-Wint-conversion]
3771 | txn->walsgmts = lappend(txn->walsgmts, curOpenSegNo);
| ^~~~~~~~~~~~
| |
| XLogSegNo {aka long unsigned int}
and
reorderbuffer.c: In function 'ReorderBufferRestoreChanges':
reorderbuffer.c:4304:31: error: assignment to 'XLogSegNo' {aka 'long unsigned int'} from 'void *' makes integer from
pointerwithout a cast [-Wint-conversion]
4304 | segno = lfirst(lc);
| ^