[fdo-internals] RE: [mapguide-internals] Exception thrown on
null values?
Dan Stoica
dan.stoica at autodesk.com
Fri Feb 29 10:17:33 EST 2008
Some thoughts:
a) IsNull() is an essential part of getting a value. In any rdbms you get a null indicator along with the value.
b) practically there is no overhead: the value/null indicator is already fetched and cached.
c) when tuned for performance, the provider shouldn't ask one million times "where is this property in the list of properties?"
Because it is the current one or the next one :-) Yes, string comparisons are a killer.
Dan.
-----Original Message-----
From: fdo-internals-bounces at lists.osgeo.org [mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
Sent: Thursday, February 28, 2008 5:38 PM
To: MapGuide Internals Mail List; FDO Internals Mail List
Subject: [fdo-internals] RE: [mapguide-internals] Exception thrown on null values?
Apart from technical solutions, I think that the best way of solving
this kind of problem is communication with the FDO development
community... entering Trac tickets with defects with provider
implementations are found, etc.
On the FDO side, ideally, there would be a compliance test suite for FDO
that exercises all of the providers against the FDO spec to ensure
consistency. This has been discussed a few times, but I don't think it
has gone anywhere.
Jason
-----Original Message-----
From: Trevor Wekel
Subject: RE: [mapguide-internals] Exception thrown on null values?
I agree with both Bruce and Traian. We absolutely need to maintain a
stable server but the IsNull() check may be a performance hit.
Personally, I would err on the side of caution and pick stability over
performance. Performance can be mitigated by purchasing more hardware.
Stability cannot.
Is there any technology - maybe virtualization based - that we could use
to insulate the various providers from the Server? Something like the
IIS "Application Protection" setting for virtual directories? We could
even use this to insulate services from each other and possibly even get
around any potential thread safety issues with specific providers by
running the providers in their own virtualized space.
I haven't looked at virtualization technology much but I was reading
some news bulletins on the web where virus software companies were using
virtualization to block root kit attacks. Might be something to
investigate.
Thanks,
Trevor
-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org
[mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Traian
Stanev
Sent: Thursday, February 28, 2008 3:21 PM
To: MapGuide Internals Mail List
Subject: RE: [mapguide-internals] Exception thrown on null values?
How do you know said future provider will implement IsNull() correctly
so that you rely on it? The answer is that you can't guarantee anything
about future providers -- it's the responsibility of whoever writes the
provider to fix it. So penalizing existing providers because of
hypothetical future providers doesn't make much sense.
Traian
> -----Original Message-----
> From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> internals-bounces at lists.osgeo.org] On Behalf Of Bruce Dechant
> Sent: Thursday, February 28, 2008 5:17 PM
> To: MapGuide Internals Mail List
> Subject: RE: [mapguide-internals] Exception thrown on null values?
>
> I agree the provider should be fixed, but what about new providers
that
> come out.
> What if they are not as diligent in their implementation? Should the
> server not try to prevent a crash to safe guard this instead of just
> blindly trusting every provider to be perfect?
>
> Bruce
>
> -----Original Message-----
> From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> internals-bounces at lists.osgeo.org] On Behalf Of Traian Stanev
> Sent: Thursday, February 28, 2008 3:14 PM
> To: MapGuide Internals Mail List
> Subject: RE: [mapguide-internals] Exception thrown on null values?
>
>
> So it will penalize everybody, instead of fixing the provider in
> question to throw an exception when it should?
>
> Traian
>
> > -----Original Message-----
> > From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> > internals-bounces at lists.osgeo.org] On Behalf Of Bruce Dechant
> > Sent: Thursday, February 28, 2008 5:12 PM
> > To: MapGuide Internals Mail List
> > Subject: RE: [mapguide-internals] Exception thrown on null values?
> >
> > Yup, but like I said at the cost of stability. :)
> >
> > I would rather do the check then have the server crash.
> >
> > -----Original Message-----
> > From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> > internals-bounces at lists.osgeo.org] On Behalf Of Traian Stanev
> > Sent: Thursday, February 28, 2008 3:09 PM
> > To: MapGuide Internals Mail List
> > Subject: RE: [mapguide-internals] Exception thrown on null values?
> >
> >
> > Hmm... always doing an IsNull() for everything has an overhead as
> well
> > -- internally to the provider it may be equivalent to getting the
> > property twice. Once to check for null and another time to get the
> > property value.
> >
> > Traian
> >
> >
> >
> > > -----Original Message-----
> > > From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> > > internals-bounces at lists.osgeo.org] On Behalf Of Bruce Dechant
> > > Sent: Thursday, February 28, 2008 5:05 PM
> > > To: MapGuide Internals Mail List
> > > Subject: RE: [mapguide-internals] Exception thrown on null values?
> > >
> > > Jason,
> > >
> > > This is the expected behavior as Traian pointed out. This was
> changed
> > > from what it was before because now we do the IsNull() check
> > internally
> > > in the server on all GetXXX() APIs just in case the user "forgot"
> to
> > > call it. This was also done to prevent memory access violations
> when
> > > trying to call for example GetString() from a reader that has a
> NULL
> > > property value and the underlying provider tries to do the read
> > string
> > > and then crashes, by adding this check we have added some server
> > > stability.
> > >
> > > Not all providers are created equally. :)
> > >
> > > Thanks,
> > > Bruce
> > >
> > >
> > > -----Original Message-----
> > > From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-
> > > internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
> > > Sent: Thursday, February 28, 2008 2:48 PM
> > > To: MapGuide Internals Mail List
> > > Subject: RE: [mapguide-internals] Exception thrown on null values?
> > >
> > > Am I allowed to say "lame"? :) NULL is a perfectly valid value
> for
> > > most data types, and throwing an exception in this case adds a lot
> of
> > > additional processing that should not be required.
> > >
> > > I personally feel that this is a case where MapGuide could make
> > > application developers lives a lot easier and improve (slightly?)
> the
> > > performance of web-level apps by swallowing the exception and
> > returning
> > > NULL.
> > >
> > > Jason
> > >
> > > -----Original Message-----
> > > From: mapguide-internals-bounces at lists.osgeo.org
> > > [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of
> > Traian
> > > Stanev
> > > Sent: Thursday, February 28, 2008 13:31
> > > To: 'MapGuide Internals Mail List'
> > > Subject: RE: [mapguide-internals] Exception thrown on null values?
> > >
> > > I think this complies with the FDO spec, which requires an
> exception
> > to
> > > be thrown when the value is null and you try to get it anyway. The
> > two
> > > solutions are to check for IsNull() before getting it, or to catch
> > the
> > > exception. The code *could* in theory return NULL in this case,
> > but...
> > >
> > > Traian
> > >
> > > > -----Original Message-----
> > > > From: mapguide-internals-bounces at lists.osgeo.org
> [mailto:mapguide-
> > > > internals-bounces at lists.osgeo.org] On Behalf Of Jason Birch
> > > > Sent: Thursday, February 28, 2008 4:29 PM
> > > > To: MapGuide Internals Mail List
> > > > Subject: [mapguide-internals] Exception thrown on null values?
> > > >
> > > > Hi,
> > > >
> > > > I'm seeing a case in MGOS 2.0 where MgFeatureReader->GetString()
> is
> > > > throwing an exception when the value of the string is null.
> > > >
> > > > Is this expected behaviour? Has it changed since 1.2? I
believe
> > > that
> > > > I've seen a similar error in geometry, but don't have a test
case
> > for
> > > > that yet.
> > > >
> > > > This is relatively easy to work around with a try/catch and
> > > suppressing
> > > > the error output if the message includes "null", but it's a bit
> > > > annoying. Is there a better way of dealing with this?
> > > >
> > > > Jason
> > > > _______________________________________________
> > > > mapguide-internals mailing list
> > > > mapguide-internals at lists.osgeo.org
> > > > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> > > _______________________________________________
> > > mapguide-internals mailing list
> > > mapguide-internals at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> > > _______________________________________________
> > > mapguide-internals mailing list
> > > mapguide-internals at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> > > _______________________________________________
> > > mapguide-internals mailing list
> > > mapguide-internals at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> > _______________________________________________
> > mapguide-internals mailing list
> > mapguide-internals at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> > _______________________________________________
> > mapguide-internals mailing list
> > mapguide-internals at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
fdo-internals mailing list
fdo-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-internals
More information about the fdo-internals
mailing list