[postgis-tickets] [PostGIS] #4684: concurrent topology construction routine may result in invalid topology

PostGIS trac at osgeo.org
Mon Jan 11 02:37:29 PST 2021


#4684: concurrent topology construction routine may result in invalid topology
-----------------------+---------------------------
  Reporter:  laopsahl  |      Owner:  strk
      Type:  defect    |     Status:  new
  Priority:  medium    |  Milestone:  PostGIS 3.0.4
 Component:  topology  |    Version:  3.0.x
Resolution:            |   Keywords:
-----------------------+---------------------------

Comment (by strk):

 While thinking about how to include row-level locking in core I found
 another case of parallel insertion of objects creating invalid topology
 which cannot be resolved by row-level locking primitive tables. It is the
 case of parallel insertion of a face and an isolated node or line insode
 the face created by the other process. Simplest scenario:

    - Process1 inserts a closed line in the empty topology
    - Process2 inserts a point inside the closed line (non visible by its
 transaction)

 Using SQL:

   P0: select createtopology('isoinface');
   P1: begin; select topogeo_addpoint('isoinface', 'POINT(5 5)');
   P2: begin: select topogeo_addlinestring('isoinface', 'LINESTRING(0 0,0
 10,10 10,10 0,0 0)');
   P1: commit;
   P2: commit;

 At the end of the above process, we'll have th `isoinface` topology
 containing 1 face, 1 edge and 2 nodes. The ISOLATED node (the one inserted
 by P1) will have a wrong `containing_face` value:

 {{{
 =# select n.node_id, st_astext(n.geom) g, n.containing_face,
    f.face_id computed_containing_face
    FROM isoinface.node n
    left outer join isoinface.face f
    ON (f.face_id != 0 and ST_Contains(ST_GetFaceGeometry('isoinface',
 f.face_id), n.geom));
  node_id |     g      | containing_face | computed_containing_face
 ---------+------------+-----------------+--------------------------
        1 | POINT(5 5) |               0 |                        1
        2 | POINT(0 0) |                 |
 (2 rows)
 }}}

 This kind of invalidity is not currently detected by ValidateTopology
 function (see #3233)

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4684#comment:18>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list