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);
}

I've been using GeoTools 8.3 as part of geoserver 2.2.1 to deliver WFS data 
from shapefiles.  I found that under load (generated with jmeter) , the 
GeoTools check to see if the index was up-to-date was causing my test system to 
grind to a halt so I disabled index creation/updating in geoserver only to find 
out that doing so completely disabled the use of the index.

I think the above block of code should be changed to introduce a separate new 
variable to enable use of the index and the createIndex variable should be 
passed in the place of the hardcoded 'true' argument.  

I developed a patch against GeoTools 8.3 to enable indexes for local files.  I 
haven't included support for setting the new variable in the params Map but I'd 
be happy to code this up and make any changes necessary to get this to work 
with GeoTools 8.4 - any interest?

I'd really like to get this fix into GeoTools if possible - for performance 
reasons, I need to have index updating off but I still need to be able to use 
the indexes (which I create offline).

Thanks,
Geoff

Attachment: shapefile_index_switch.patch
Description: shapefile_index_switch.patch

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to