Ignore SIGPIPE in GTM and GTM Proxy

SIGPIPE causes these processes to exit prematurely if the remote side
goes away without properly closing connections. For now, just ignore the signal
Improve GTM connecting establishment handling

We currently wait without timeout for GTM connection. This creates issues,
especially when GTM proxies are involved since GTM proxy keeps retrying
establishing connection with the GTM proper. That causes the
coordinator/backend to wait infinitely. This also prevents shutdown of those
components when GTM is down.

We now retry with a timed wait and also check for interrupts more often to
ensure that shutdown requests are honored
Also check for IsConnFromDatanode() while deciding to use global snapshots
This commit showing problems in regression. Revert pending further
investigations

This reverts commit c4df224dd011afd640c122bbb6a5cd12b5e9d54d.
Revert "Do not read prototype config file when dealing with user specified conf file"

This reverts commit 9d95e395d43d4c9c91908cc67099ed3c9ebda960.
Allow compilation on FreeBSD and also check for existance of bash

Report and patch from Jov.
Do not read prototype config file when dealing with user specified conf file

pgxc_ctl utility was picking up parameters from the default configuration when
such parameters are not defined in the conf file. This creates all sorts of
unintentional side effects. Fix that by skipping default conf while dealing
with a specified conf file.

We had got this wrong in the first attempt. Hopefully, its better now
Fix a core dump in SharedQueueBind because of hash table overflow

Report and patch by Jasonysli
Reset local_params post transaction prepare.

We were leaving behind a dangling pointer, thus causing segfaults with prepared
transactions.

Per report from Jov
Add a new "minimal" option to "prepare" command of pgxc_ctl.

If this option is provided then prepare will create a template config file
suitable for setting up a localhost-only XL cluster of GTM, 1 GTM proxy, 2
Coordinators and 2 Datanodes, all running locally.

There is also a "complete" option, which is also the default, to create a more
complete template suitable for multi-node setup
Fix a bug where a failed PREPARE TRANSACTION would end up rolling back another
transaction

This bug was seen when user tries to prepare a transaction with an existing
identifier. In that case, datanodes report error, but the coordinator would
send ROLLBACK PREPARED to those datanodes, thus rolling back already prepared
transaction with the same identifier

Report from Jov, investigations and bug fix from me.
Allow "make check" to work with XL

This patch corrects a few things so that a temporary installation of XL is
created and configured properly for "make check" to run fine.

Patch from Jov.
Consume command ID once its used for remote utility statement

This ensures that the subsequent command to the remote node gets a higher
numbered command ID
Cleanup old bash scripts in pgxc_ctl contrib module and other changes.

This patch also removes certain files from git repository which are
auto-generated when the utility is built. The recent changes to create
different config templates is also integrated into the auto-generation
mechanism.

Some changes in this patch are contributed by Jov and there are bunch of other
changes made by me.
Use proper MACROs to send ancillary data over sockets.

The existing code while survived on most Linux distros, it failed on FreeBSD.

Report and patch by Jov
Add a #ifdef XCP directive the minimal config file.

We did not do this earlier since its a new thing in XL. But "ex" utility on
FreeBSD complains about missing patterns.
Adjust shared queues param units and minimum.
Clean up freeing list of connections.

While hunting for a memory leak, found this smaller one.
Push down LIMIT clause to the remote side if its a constant

The current code was broken, for example when OFFSET 0 is specified in the
query.
Merge branch 'master' of ssh://git.code.sf.net/p/postgres-xl/postgres-xl into new-master