You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Kevin A. Burton" <bu...@newsmonster.org> on 2004/07/08 06:34:25 UTC

Lucene shouldn't use java.io.tmpdir

As per 1.3 (or was it 1.4) Lucene migrated to using java.iot.tmpdir to 
store the locks for the index.

While under most situations this is save a lot of application servers 
change java.io.tmpdir at runtime.

Tomcat is a good example.  Within Tomcat this property is set to 
TOMCAT_HOME/temp..

Under this situation if I were to create two IndexWriters within two VMs 
and try to write to the same index  the index would get corrupted if one 
Lucene instance was within Tomcat and the other was within a standard VM.

I think we should consider either:

1. Using out own tmpdir property based on the given OS.
2. Go back to the old mechanism of storing the locks within the index 
basedir (if it's not readonly).

Thoughts?

-- 

Please reply using PGP.

    http://peerfear.org/pubkey.asc    
    
    NewsMonster - http://www.newsmonster.org/
    
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
       AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
  IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Lucene shouldn't use java.io.tmpdir

Posted by "Kevin A. Burton" <bu...@newsmonster.org>.
Doug Cutting wrote:

> Kevin A. Burton wrote:
>
>> This is why I think it makes more sense to use our own java.io.tmpdir 
>> to be on the safe side.
>
>
> I think the bug is that Tomcat changes java.io.tmpdir. I thought that 
> the point of the system property java.io.tmpdir was to have a portable 
> name for /tmp on unix, c:\windows\tmp on Windows, etc. Tomcat breaks 
> that. So must Lucene have its own way of finding the platform-specific 
> temporary directory that everyone can write to? Perhaps, but it seems 
> a shame, since Java already has a standard mechanism for this, which 
> Tomcat abuses...

I've seen this done in other places as well. I think Weblogic did/does 
it. I'm wondering what some of these big EJB containsers use which is 
why I brought this up. I'm not sure the problem is just with Tomcat.

Kevin

-- 

Please reply using PGP.

    http://peerfear.org/pubkey.asc    
    
    NewsMonster - http://www.newsmonster.org/
    
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
       AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
  IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Lucene shouldn't use java.io.tmpdir

Posted by Doug Cutting <cu...@apache.org>.
Kevin A. Burton wrote:
> This is why I think it makes more sense to use our own java.io.tmpdir to 
> be on the safe side.

I think the bug is that Tomcat changes java.io.tmpdir.  I thought that 
the point of the system property java.io.tmpdir was to have a portable 
name for /tmp on unix, c:\windows\tmp on Windows, etc.  Tomcat breaks 
that.  So must Lucene have its own way of finding the platform-specific 
temporary directory that everyone can write to?  Perhaps, but it seems a 
shame, since Java already has a standard mechanism for this, which 
Tomcat abuses...

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Lucene shouldn't use java.io.tmpdir

Posted by "Kevin A. Burton" <bu...@newsmonster.org>.
Otis Gospodnetic wrote:

>Hey Kevin,
>
>Not sure if you're aware of it, but you can specify the lock dir, so in
>your example, both JVMs could use the exact same lock dir, as long as
>you invoke the VMs with the same params.  
>
Most people won't do this or won't even understand WHY they need to do 
this :-/.

>You shouldn't be writing the
>same index with more than 1 IndexWriter though (not sure if this was
>just a bad example or a real scenario).
>  
>
Yes... I realize that you shouldn't use more than one IndexWriter. That 
was the point. The locks are to prevent this from happening. If one were 
to accidentally do this the locks would be in different directories and 
our IndexWriter would corrupt the index.

This is why I think it makes more sense to use our own java.io.tmpdir to 
be on the safe side.

-- 

Please reply using PGP.

    http://peerfear.org/pubkey.asc    
    
    NewsMonster - http://www.newsmonster.org/
    
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
       AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
  IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Lucene shouldn't use java.io.tmpdir

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hey Kevin,

Not sure if you're aware of it, but you can specify the lock dir, so in
your example, both JVMs could use the exact same lock dir, as long as
you invoke the VMs with the same params.  You shouldn't be writing the
same index with more than 1 IndexWriter though (not sure if this was
just a bad example or a real scenario).

Otis


--- "Kevin A. Burton" <bu...@newsmonster.org> wrote:
> As per 1.3 (or was it 1.4) Lucene migrated to using java.iot.tmpdir
> to 
> store the locks for the index.
> 
> While under most situations this is save a lot of application servers
> 
> change java.io.tmpdir at runtime.
> 
> Tomcat is a good example.  Within Tomcat this property is set to 
> TOMCAT_HOME/temp..
> 
> Under this situation if I were to create two IndexWriters within two
> VMs 
> and try to write to the same index  the index would get corrupted if
> one 
> Lucene instance was within Tomcat and the other was within a standard
> VM.
> 
> I think we should consider either:
> 
> 1. Using out own tmpdir property based on the given OS.
> 2. Go back to the old mechanism of storing the locks within the index
> 
> basedir (if it's not readonly).
> 
> Thoughts?
> 
> -- 
> 
> Please reply using PGP.
> 
>     http://peerfear.org/pubkey.asc    
>     
>     NewsMonster - http://www.newsmonster.org/
>     
> Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
>        AIM/YIM - sfburtonator,  Web - http://peerfear.org/
> GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
>   IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org