Add GetWALInsertionTimeLine(); also return it via GetFlushRecPtr().
Having lots of code that relies on the ThisTimeLineID global variable
is problematic, but to have any chance of fixing that, we must provide
another way for code outside xlog.c to get the relevant value. This
commit adds infrastructure for doing that on a system that is in
normal running, but doesn't do anything about the case where the
system is in recovery.
Here, we provide two different methods for getting the timeline of
a system in normal running. First, a number of the places where we
call GetFlushRecPtr() need the timeline as well, so provide it via
an out parameter. Second, for other places that just need the
timeline and not any LSN, add a GetWALInsertionTimeLine() function.
Future commits will take care of actually removing references to
ThisTimeLineID; this commit is just infrastructure.