sendTimeLineIsHistoric = state->currTLI == ThisTimeLineID;
sendTimeLineIsHistoric = state->currTLI != ThisTimeLineID;
I was facing another issue.
On promotion of a cascaded server ThisTimeLineID in the standby server having
logical slot becomes 0.
Then i added a function call to GetStandbyFlushRecPtr in
StartLogicalReplication which updates ThisTimeLineID.
After the above two changes timeline following is working.But i'm not sure
whether this is correct or not.In any case please someone clarify.