• D
    QE writer should cancel QE readers before aborting · 206ffa6c
    David Kimura 提交于
    If a QE writer marks the transaction as aborted while a reader is
    still executing the query the reader may affect shared memory state.
    E.g. consider a transaction being aborted and a table needs to be
    dropped as part of abort processing.  If the writer has dropped all
    the buffers belonging to the table from shared buffer cache and is
    about to unlink the file for the table.  Concurrently, a reader,
    unaware of the writer's abort, is still executing the query.  The
    reader may bring in a page from the file that the writer is about to
    unlink into shared buffer cache.
    
    In order to prevent such situations the writer walks procArray to find
    the readers and sends SIGINT to them.
    
    Walking procArray is expensive, and is avoided as much as possible.
    The patch walks the procArray only if the command being aborted (or
    the last command in a transaction that is being aborted) performed a
    write and at least one reader slice was part of the query plan.
    
    To avoid confusion on the QD due to "canceling MPP operation" error
    messages emitted by the readers upon receiving the SIGINT, the readers
    do not emit them on the libpq channel.
    
    Discussion:
    https://groups.google.com/a/greenplum.org/d/msg/gpdb-dev/S2WL1FtJEJ0/Wh6DfJ-RBwAJCo-authored-by: NEkta Khanna <ekhanna@pivotal.io>
    Co-authored-by: NAsim R P <apraveen@pivotal.io>
    Co-authored-by: NTaylor Vesely <tvesely@pivotal.io>
    206ffa6c
writer_aborts_reader.sql 4.7 KB