Hello Amit,
>> It'd not really simplify things, but it'd keep it local.
>
> How about using the value of guc (checkpoint_flush_to_disk) and
> AmCheckpointerProcess to identify whether to do async flush in
> FileWrite?
ISTM that what you suggest would just replace the added function arguments
with global variables to communicate and keep the necessary data for
managing the asynchronous flushing, which is called per tablespace
(1) on file changes (2) when the checkpointer is going to sleep.
Although it can be done obviously, I prefer to have functions arguments
rather than global variables, on principle.
Also, because of (2) and of the dependency on the number of tablespaces
being flushed, the flushing stuff cannot be fully hidden from the
checkpointer anyway.
Also I think that probably the bgwriter should do something similar, so
function parameters would be useful to drive flushing from it, rather than
adding yet another set of global variables, or share the same variables
for somehow different purposes.
So having these added parameters look reasonable to me.
--
Fabien.