[MAPSERVER-DEV] [Fwd: [MapServer] #2497: mappostgis.c: BEGIN transaction once in msPOSTGISLayerOpen rather than repeatedly in prepare_database]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[MAPSERVER-DEV] [Fwd: [MapServer] #2497: mappostgis.c: BEGIN transaction once in msPOSTGISLayerOpen rather than repeatedly in prepare_database]

David Fuhry-2
I opened ticket 2497 to remove redundant BEGIN sql calls for postgis
layers which use pooled connections.  A proposed patch is submitted in trac.

Thanks,

Dave Fuhry

-------- Original Message --------
Subject: [MapServer] #2497: mappostgis.c: BEGIN transaction once in
msPOSTGISLayerOpen rather than repeatedly in prepare_database
Date: Fri, 08 Feb 2008 00:54:57 -0000
From: MapServer <[hidden email]>
Reply-To: [hidden email]
To: undisclosed-recipients:;

#2497: mappostgis.c: BEGIN transaction once in msPOSTGISLayerOpen rather
than repeatedly in prepare_database
---------------------------------+------------------------------------------
  Reporter:  dfuhry               |       Owner:  sdlime
      Type:  defect               |      Status:  new
  Priority:  normal               |   Milestone:  5.2 release
Component:  MapServer C Library  |     Version:  svn-trunk (development)
  Severity:  normal               |    Keywords:  postgis transaction begin
---------------------------------+------------------------------------------
  Currently, mappostgis.c in prepare_database() issues a
PQexec(layerinfo->conn, "BEGIN") every time a postgis layer is rendered,
  even if CLOSE_CONNECTION=DEFER is set for the layer.

  Since the db connection is recycled, this makes unnecessary calls to
the database and results in a:

  WARNING:  there is already a transaction in progress

  message in the postgresql log file each time a postgis layer is
rendered. The per-layer call gives no extra safety since a redundant
BEGIN will not start a new transaction, nor will one "fix" a transaction
in which an error has occurred.

  All postgis queries are "DECLARE CURSOR ..." so a transaction is
  necessary, but the transaction can be started when the layer is opened.
  The proposed patch moves the PQexec(layerinfo->conn, "BEGIN") call to
  msPOSTGISLayerOpen(), so that it will be issued only once when the
  connection is opened.

  Tested on Linux with CLOSE_CONNECTION=DEFER layers and FastCGI.

--
Ticket URL: <http://trac.osgeo.org/mapserver/ticket/2497>
MapServer <http://mapserver.gis.umn.edu>
MapServer