Layer Virtualization and LayerCloseConnection vs LayerClose (SDE issues)

Jani Averbach javerbach at EXTENDTHEREACH.COM
Thu Mar 2 12:50:34 EST 2006

> -----Original Message-----
> Sent: Friday, February 24, 2006 1:30 PM
> Subject: Layer Virtualization and LayerCloseConnection vs LayerClose
> (SDE issues)


> I found a problem with the SDE driver where we weren't closing out
> layer information.  The layer virtualization has two methods,
> LayerCloseConnection and LayerClose.  In SDE, they were both being
> used, and LayerClose was set to a NoOp function that was just
> returning success.  This wasn't allowing the SDE driver to free up
> its layer information and decrement the connection pool when a layer
> was closed.

The layer virtualization uses this pattern, because that was what the
old code was doing: maplayer.c:msLayerClose for SDE was no-op, and
layer close was actually called from mapfile.c:msCloseConnections
function. So I tried to replicate that usage pattern with vtable.

> I have fixed this by commenting out the definition of the 
> layer->vtable->LayerCloseConnection method in the 
> msSDELayerInitializeVirtualTable method, replacing the NoOp method to 
> use our regular msSDELayerClose method, and removing the NoOp method 
> completely.

Ok, I can't comment this, because I don't know internals of SDE well

> Was there a reason why we took this approach in the SDE driver?  I 
> vaguely remember possibly even asking for a LayerCloseConnection 
> method, but I'm not sure.  Do you have any recollection?  

The reason why we have these two methods is that there was/is code
which uses that above pattern: msLayerClose does nothing, actual
closing happens from msCloseConnection.

> I think the intent for layers using connection pooling is that each
> driver's Open and Close methods will take care of that and it
> wouldn't be needed in the layer virtualization.  Maybe that is not
> the case for a plugin layer that might be providing its own
> connection pooling?  Is that why there are two methods?
> I think we could get by with just having LayerClose and LayerOpen 
> deal with connection pooling issues entirely and not have to worry 
> about them in the layer virtualization, but I'm not a 100% sure.  

If you can remove mapfile.c:msCloseConnections then in theory we could
remove this vtable->CloseConnection function pointer (however, it will
be API-level incompatible change compared to 4.8). On the other hand,
if we like to provide as generic as possible interface for feature
layers, then It might be a good thing to keep.  *shrug*

BR, Jani

SRC in Action:

Join SRC at Extend 2006 - Disruptive Technology
June 5-7, 2006 at the Hyatt Regency, Huntington Beach, CA
For more details, click here:

More information about the mapserver-dev mailing list