Обсуждение: pgsql: Move the handling of SELECT FOR UPDATE locking and rechecking out

Поиск
Список
Период
Сортировка

pgsql: Move the handling of SELECT FOR UPDATE locking and rechecking out

От
tgl@postgresql.org (Tom Lane)
Дата:
Log Message:
-----------
Move the handling of SELECT FOR UPDATE locking and rechecking out of
execMain.c and into a new plan node type LockRows.  Like the recent change
to put table updating into a ModifyTable plan node, this increases planning
flexibility by allowing the operations to occur below the top level of the
plan tree.  It's necessary in any case to restore the previous behavior of
having FOR UPDATE locking occur before ModifyTable does.

This partially refactors EvalPlanQual to allow multiple rows-under-test
to be inserted into the EPQ machinery before starting an EPQ test query.
That isn't sufficient to fix EPQ's general bogosity in the face of plans
that return multiple rows per test row, though.  Since this patch is
mostly about getting some plan node infrastructure in place and not about
fixing ten-year-old bugs, I will leave EPQ improvements for another day.

Another behavioral change that we could now think about is doing FOR UPDATE
before LIMIT, but that too seems like it should be treated as a followon
patch.

Modified Files:
--------------
    pgsql/src/backend/commands:
        explain.c (r1.191 -> r1.192)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/explain.c?r1=1.191&r2=1.192)
    pgsql/src/backend/executor:
        Makefile (r1.30 -> r1.31)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/Makefile?r1=1.30&r2=1.31)
        README (r1.9 -> r1.10)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/README?r1=1.9&r2=1.10)
        execAmi.c (r1.105 -> r1.106)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execAmi.c?r1=1.105&r2=1.106)
        execCurrent.c (r1.10 -> r1.11)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execCurrent.c?r1=1.10&r2=1.11)
        execMain.c (r1.332 -> r1.333)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execMain.c?r1=1.332&r2=1.333)
        execProcnode.c (r1.67 -> r1.68)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execProcnode.c?r1=1.67&r2=1.68)
        execUtils.c (r1.163 -> r1.164)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execUtils.c?r1=1.163&r2=1.164)
        nodeSubqueryscan.c (r1.41 -> r1.42)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeSubqueryscan.c?r1=1.41&r2=1.42)
    pgsql/src/backend/nodes:
        copyfuncs.c (r1.443 -> r1.444)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.443&r2=1.444)
        equalfuncs.c (r1.365 -> r1.366)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.365&r2=1.366)
        outfuncs.c (r1.367 -> r1.368)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.367&r2=1.368)
        readfuncs.c (r1.224 -> r1.225)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/readfuncs.c?r1=1.224&r2=1.225)
    pgsql/src/backend/optimizer/path:
        allpaths.c (r1.186 -> r1.187)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/allpaths.c?r1=1.186&r2=1.187)
    pgsql/src/backend/optimizer/plan:
        createplan.c (r1.264 -> r1.265)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/createplan.c?r1=1.264&r2=1.265)
        planner.c (r1.258 -> r1.259)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c?r1=1.258&r2=1.259)
        setrefs.c (r1.151 -> r1.152)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/setrefs.c?r1=1.151&r2=1.152)
        subselect.c (r1.154 -> r1.155)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/subselect.c?r1=1.154&r2=1.155)
    pgsql/src/backend/optimizer/prep:
        preptlist.c (r1.96 -> r1.97)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/preptlist.c?r1=1.96&r2=1.97)
        prepunion.c (r1.175 -> r1.176)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c?r1=1.175&r2=1.176)
    pgsql/src/backend/optimizer/util:
        relnode.c (r1.94 -> r1.95)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/relnode.c?r1=1.94&r2=1.95)
    pgsql/src/backend/parser:
        analyze.c (r1.391 -> r1.392)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/analyze.c?r1=1.391&r2=1.392)
    pgsql/src/include/catalog:
        catversion.h (r1.544 -> r1.545)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.544&r2=1.545)
    pgsql/src/include/executor:
        executor.h (r1.161 -> r1.162)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/executor/executor.h?r1=1.161&r2=1.162)
    pgsql/src/include/nodes:
        execnodes.h (r1.209 -> r1.210)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h?r1=1.209&r2=1.210)
        nodes.h (r1.229 -> r1.230)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/nodes.h?r1=1.229&r2=1.230)
        parsenodes.h (r1.405 -> r1.406)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.405&r2=1.406)
        plannodes.h (r1.111 -> r1.112)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/plannodes.h?r1=1.111&r2=1.112)
        relation.h (r1.176 -> r1.177)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.176&r2=1.177)
    pgsql/src/include/optimizer:
        planmain.h (r1.119 -> r1.120)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/planmain.h?r1=1.119&r2=1.120)

Added Files:
-----------
    pgsql/src/backend/executor:
        nodeLockRows.c (r1.1)

(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeLockRows.c?rev=1.1&content-type=text/x-cvsweb-markup)
    pgsql/src/include/executor:
        nodeLockRows.h (r1.1)

(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/executor/nodeLockRows.h?rev=1.1&content-type=text/x-cvsweb-markup)