Ticket #2626 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

idle PostGIS connections are in transactions, which hold locks on queried tables

Reported by: dfuhry Assigned to: pramsey
Priority: normal Milestone:
Component: PostGIS Interface Version: svn-trunk (development)
Severity: normal Keywords: mappostgis.c postgis transactions idle
Cc: pramsey, Ivan Mincik <ivan.mincik at gmail.com>

Description

Idle (pooled) PostGIS connections remain in transactions, and although all queries are readonly, some DDL queries like ALTER TABLE to hang indefinitely while the in-transaction connections are active. Probably having something to do with a transaction's guarantee of presenting the user with a consistent view of the database.

http://lists.osgeo.org/pipermail/mapserver-users/2008-May/055977.html

The proposed patch enters a transaction before the DECLARE BINARY CURSOR call and issues ROLLBACK after the FETCH ALL resultset is processed. So idle connections are no longer in a transaction.

It passed my basic tests. I made some rather heavy changes to the end of msPOSTGISLayerGetShape, collapsing two mutually exclusive CLOSE [cursor] call paths into a single one. The previous code paths were somewhat hard to follow. I hope I preserved the logic correctly.

I'm pretty sure I corrected a bug where CLOSE [cursor] was not being called when in msPOSTGISLayerGetShape, shape->type == MS_SHAPE_NULL.

Attachments

ms_postgis_trans.v1.diff (7.9 kB) - added by dfuhry on 05/22/08 12:57:55.

Change History

05/22/08 12:57:55 changed by dfuhry

  • attachment ms_postgis_trans.v1.diff added.

05/22/08 21:19:07 changed by pramsey

Applied to trunk in r7614.

05/22/08 21:24:09 changed by pramsey

  • status changed from new to closed.
  • resolution set to fixed.

Applied to branch-5-0 in r7615.