On Fri, Nov 30, 2012 at 8:17 AM, Geoff Williams <[email protected]>wrote:
>
> Hi List,
>
> I think I've found a bug in the logic of the ShapeFileDataStoreFactory
> class.
>
> In the createNewDataStore() method, I've noticed that the createIndex
> variable is used to actually control whether the index is used. When
> enabled, indexes are always (re)created. Here's the relevant code:
>
> if (createIndex) {
> store = new IndexedShapefileDataStore(url, namespace,
> useMemoryMappedBuffer, cacheMemoryMaps, true,
> IndexType.QIX, dbfCharset);
> } else {
> store = new ShapefileDataStore(url, namespace,
> useMemoryMappedBuffer, cacheMemoryMaps, dbfCharset);
> }
>
Looked at the patch, which stats with a rather scary code:
boolean createIndex = isCreateSpatialIndex.booleanValue() &&
isLocal;
+ boolean enableIndex = true && isLocal;
true && isLocal, really? :-)
Anyways, the result is that the store ends up creating a
IndexedShapefileDataStore every time
the shapefile is local.
Hum... makes some sense, but doesn't the datastore end up checking if the
index file exists
every time it has to use it anyways?
Wondering how checking for file existance is so much lighter than comparing
two last modification
dates: don't get me wrong, it's certainly lighter, but I'm surprised it
makes a difference between
grinding the system to a halt and making it work fine... what operating
system and file system
are you using?
Anyways, not opposed to the change per se, the original code was there
because the indexed
store was experimental, but years have passed by and it's not experimental
anymore... I'm
actually in the process of throwing both of them away and introduce a
single new implementation
in the 9.x series.
Cheers
Andrea
--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users