I've opened an issue https://issues.apache.org/jira/browse/SOLR-1527
2009/10/28 Noble Paul നോബിള് नोब्ळ् <noble.p...@corp.aol.com>: > hi, > Looks like a bug. open an issue. > > > On Wed, Oct 28, 2009 at 4:04 AM, Jeremy Hinegardner > <jer...@hinegardner.org> wrote: >> Hi all, >> >> I was trying to use the new 'shareSchema=true' feature in solr 1.4 and >> it appears as though this will only happen in one configuration. I'd like >> someone to confirm this for me and then we can file a bug on it. >> >> This all happens in CoreContainer.create(). >> >> When you have shareSchema=true in solr.xml then an instance variable >> indexSchemaCache is created in the CoreContainer instance. >> >> This snippet is from CoreContainer.create >> >> if (indexSchemaCache != null){ >> //schema sharing is enabled. so check if it already is loaded >> >> [1] File schemFile = new File(solrLoader.getInstanceDir() + "conf" + >> File.separator + dcore.getSchemaName()); >> if(schemFile. exists()){ >> [2] String key = schemFile.getAbsolutePath()+":"+new >> SimpleDateFormat("yyyyMMddhhmmss").format(new >> Date(schemFile.lastModified())); >> >> schema = indexSchemaCache.get(key); >> if(schema == null){ >> log.info("creating new schema object for core: " + dcore.name); >> schema = new IndexSchema(config, dcore.getSchemaName(), null); >> indexSchemaCache.put(key,schema); >> } else { >> log.info("re-using schema object for core: " + dcore.name); >> } >> } >> } >> if(schema == null){ >> schema = new IndexSchema(config, dcore.getSchemaName(), null); >> } >> >> A couple of points: >> >> [1] dcore.getSchemaName() is the value that is in the 'schema' >> <core /> element in the solr.xml. This means that the this MUST >> be relative to the core-instance-dir/conf directory. Putting an >> absolute path in the xml means that schemFile.exists() will always >> return false. That is, if I put in >> >> <core name="core0" >> schema="/opt/search/solr/conf/multicore-common-schema.xml" /> >> >> then schemFile will have a path of: >> >> >> /path/to/core0/instanceDir/conf/opt/search/solr/conf/multicore-common-schema.xml >> >> Which never exists. >> >> [2] If you do use a relative path to the schema.xml file, then the key will >> always be >> unique, since each schemFile is relative to a core's instanceDir, the >> core name is >> in the path and schemFile.getAbsolutePathe() will always be unique for >> every core. >> >> The result of this is, if I wanted to use shareSchema, it looks like the >> only way for that to happen, is if two cores are using the same instanceDir >> but different dataDir. >> >> I tried a test with this solr.xml in the example multicore configurae, and >> this >> appears to be the only way to reuse the schema instance, and to me this has a >> bit of a smell: >> >> <solr persistent="false"> >> <cores adminPath="/admin/cores" shareSchema="true" > >> <core name="core0" instanceDir="mcore" schema="schema-common.xml" >> dataDir="core0/data" /> >> <core name="core1" instanceDir="mcore" schema="schema-common.xml" >> dataDir="core1/data" /> >> </cores> >> </solr> >> >> In my initial playing with this feature, I assumed that just putting in >> the full path to a common schema.xml file would do the trick. That is >> evidently not the way it works. >> >> What is the way that shareSchema=true is supposed to work? >> >> enjoy, >> >> -jeremy >> >> -- >> ======================================================================== >> Jeremy Hinegardner jer...@hinegardner.org >> >> > > > > -- > ----------------------------------------------------- > Noble Paul | Principal Engineer| AOL | http://aol.com > -- ----------------------------------------------------- Noble Paul | Principal Engineer| AOL | http://aol.com