Fix (some of the) breakage introduced into query-cancel processing by HS.
Fix (some of the) breakage introduced into query-cancel processing by HS.

It is absolutely not okay to throw an ereport(ERROR) in any random place in
the code just because DoingCommandRead is set; interrupting, say, OpenSSL
in the midst of its activities is guaranteed to result in heartache.

Instead of that, undo the original optimizations that threw away
QueryCancelPending anytime we were starting or finishing a command read, and
instead discard the cancel request within ProcessInterrupts if we find that
there is no HS reason for forcing a cancel and we are DoingCommandRead.

In passing, may I once again condemn the practice of changing the code
and not fixing the adjacent comment that you just turned into a lie?

techdragon/Postgres-XL,arcivanov/postgres-xl,ashwinstar/gpdb,techdragon/Postgres-XL,snaga/postgres-xl,lisakowen/gpdb,pavanvd/postgres-xl,xinzweb/gpdb,tpostgres-projects/tPostgres,adam8157/gpdb,zeroae/postgres-xl,jmcatamney/gpdb,postmind-net/postgres-xl,greenplum-db/gpdb,oberstet/postgres-xl,postmind-net/postgres-xl,xinzweb/gpdb,snaga/postgres-xl,pavanvd/postgres-xl,ashwinstar/gpdb,pavanvd/postgres-xl,greenplum-db/gpdb,greenplum-db/gpdb,50wu/gpdb,arcivanov/postgres-xl,oberstet/postgres-xl,50wu/gpdb,snaga/postgres-xl,adam8157/gpdb,techdragon/Postgres-XL,kmjungersen/PostgresXL,adam8157/gpdb,greenplum-db/gpdb,kmjungersen/PostgresXL,50wu/gpdb,ovr/postgres-xl,50wu/gpdb,lisakowen/gpdb,ashwinstar/gpdb,lisakowen/gpdb,snaga/postgres-xl,ashwinstar/gpdb,50wu/gpdb,greenplum-db/gpdb,lisakowen/gpdb,arcivanov/postgres-xl,lisakowen/gpdb,adam8157/gpdb,xinzweb/gpdb,zeroae/postgres-xl,ovr/postgres-xl,yazun/postgres-xl,xinzweb/gpdb,ashwinstar/gpdb,adam8157/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,50wu/gpdb,yazun/postgres-xl,jmcatamney/gpdb,adam8157/gpdb,50wu/gpdb,techdragon/Postgres-XL,jmcatamney/gpdb,xinzweb/gpdb,yazun/postgres-xl,Postgres-XL/Postgres-XL,lisakowen/gpdb,tpostgres-projects/tPostgres,arcivanov/postgres-xl,xinzweb/gpdb,yazun/postgres-xl,jmcatamney/gpdb,adam8157/gpdb,arcivanov/postgres-xl,oberstet/postgres-xl,snaga/postgres-xl,Postgres-XL/Postgres-XL,oberstet/postgres-xl,tpostgres-projects/tPostgres,jmcatamney/gpdb,greenplum-db/gpdb,techdragon/Postgres-XL,arcivanov/postgres-xl,pavanvd/postgres-xl,Postgres-XL/Postgres-XL,greenplum-db/gpdb,zeroae/postgres-xl,ovr/postgres-xl,jmcatamney/gpdb,greenplum-db/gpdb,ovr/postgres-xl,lisakowen/gpdb,xinzweb/gpdb,tpostgres-projects/tPostgres,yazun/postgres-xl,tpostgres-projects/tPostgres,kmjungersen/PostgresXL,pavanvd/postgres-xl,postmind-net/postgres-xl,oberstet/postgres-xl,50wu/gpdb,postmind-net/postgres-xl,jmcatamney/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,lisakowen/gpdb,postmind-net/postgres-xl,Postgres-XL/Postgres-XL,kmjungersen/PostgresXL,Postgres-XL/Postgres-XL,ovr/postgres-xl,xinzweb/gpdb,adam8157/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,kmjungersen/PostgresXL