Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

connection.c

Blame
    • Robert Haas's avatar
      ae9bfc5d
      postgres_fdw: Allow cancellation of transaction control commands. · ae9bfc5d
      Robert Haas authored
      Commit f039eaac, later back-patched
      with commit 1b812afb, allowed many of
      the queries issued by postgres_fdw to fetch remote data to respond to
      cancel interrupts in a timely fashion.  However, it didn't do anything
      about the transaction control commands, which remained
      noninterruptible.
      
      Improve the situation by changing do_sql_command() to retrieve query
      results using pgfdw_get_result(), which uses the asynchronous
      interface to libpq so that it can check for interrupts every time
      libpq returns control.  Since this might result in a situation
      where we can no longer be sure that the remote transaction state
      matches the local transaction state, add a facility to force all
      levels of the local transaction to abort if we've lost track of
      the remote state; without this, an apparently-successful commit of
      the local transaction might fail to commit changes made on the
      remote side.  Also, add a 60-second timeout for queries issue during
      transaction abort; if that expires, give up and mark the state of
      the connection as unknown.  Drop all such connections when we exit
      the local transaction.  Together, these changes mean that if we're
      aborting the local toplevel transaction anyway, we can just drop the
      remote connection in lieu of waiting (possibly for a very long time)
      for it to complete an abort.
      
      This still leaves quite a bit of room for improvement.  PQcancel()
      has no asynchronous interface, so if we get stuck sending the cancel
      request we'll still hang.  Also, PQsetnonblocking() is not used, which
      means we could block uninterruptibly when sending a query.  There
      might be some other optimizations possible as well.  Nonetheless,
      this allows us to escape a wait for an unresponsive remote server
      quickly in many more cases than previously.
      
      Report by Suraj Kharage.  Patch by me and Rafia Sabih.  Review
      and testing by Amit Kapila and Tushar Ahuja.
      
      Discussion: http://postgr.es/m/CAF1DzPU8Kx+fMXEbFoP289xtm3bz3t+ZfxhmKavr98Bh-C0TqQ@mail.gmail.com
      ae9bfc5d
      History
      postgres_fdw: Allow cancellation of transaction control commands.
      Robert Haas authored
      Commit f039eaac, later back-patched
      with commit 1b812afb, allowed many of
      the queries issued by postgres_fdw to fetch remote data to respond to
      cancel interrupts in a timely fashion.  However, it didn't do anything
      about the transaction control commands, which remained
      noninterruptible.
      
      Improve the situation by changing do_sql_command() to retrieve query
      results using pgfdw_get_result(), which uses the asynchronous
      interface to libpq so that it can check for interrupts every time
      libpq returns control.  Since this might result in a situation
      where we can no longer be sure that the remote transaction state
      matches the local transaction state, add a facility to force all
      levels of the local transaction to abort if we've lost track of
      the remote state; without this, an apparently-successful commit of
      the local transaction might fail to commit changes made on the
      remote side.  Also, add a 60-second timeout for queries issue during
      transaction abort; if that expires, give up and mark the state of
      the connection as unknown.  Drop all such connections when we exit
      the local transaction.  Together, these changes mean that if we're
      aborting the local toplevel transaction anyway, we can just drop the
      remote connection in lieu of waiting (possibly for a very long time)
      for it to complete an abort.
      
      This still leaves quite a bit of room for improvement.  PQcancel()
      has no asynchronous interface, so if we get stuck sending the cancel
      request we'll still hang.  Also, PQsetnonblocking() is not used, which
      means we could block uninterruptibly when sending a query.  There
      might be some other optimizations possible as well.  Nonetheless,
      this allows us to escape a wait for an unresponsive remote server
      quickly in many more cases than previously.
      
      Report by Suraj Kharage.  Patch by me and Rafia Sabih.  Review
      and testing by Amit Kapila and Tushar Ahuja.
      
      Discussion: http://postgr.es/m/CAF1DzPU8Kx+fMXEbFoP289xtm3bz3t+ZfxhmKavr98Bh-C0TqQ@mail.gmail.com
    connection.c NaN GiB