Opened 16 years ago

Closed 16 years ago

#2626 closed defect (fixed)

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

Reported by: dfuhry Owned by: 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 (1)

ms_postgis_trans.v1.diff (7.9 KB ) - added by dfuhry 16 years ago.

Download all attachments as: .zip

Change History (3)

by dfuhry, 16 years ago

Attachment: ms_postgis_trans.v1.diff added

comment:1 by pramsey, 16 years ago

Applied to trunk in r7614.

comment:2 by pramsey, 16 years ago

Resolution: fixed
Status: newclosed

Applied to branch-5-0 in r7615.

Note: See TracTickets for help on using tickets.