lucene-pylucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <va...@apache.org>
Subject Re: FacetExample.py
Date Thu, 14 Feb 2013 08:24:37 GMT

On Thu, 14 Feb 2013, Dawid Weiss wrote:

>> about the randomness: I think this should not be the case. if
>> different threads try to share the same random, actually there should
>> be an exception from the test framework saying that each thread should
>> get its own random (eg. initialized by a long value). So lucene-java
>> tests should not have code that does this: otherwise it really makes
>> test failures difficult to reproduce.
>
> This is exactly the case. The same instance of Random (acquired from
> the randomized context) is bound to one thread and will throw an
> exception if another thread tries to use it. You should check though
> -- there are places in the code where a normal Random is created with
> a seed provided by the "framework's random". This is to speed up
> computations or in places where I couldn't propagate per-thread
> randoms normally.
>
> Per-thread Random instances are always initialized with the same
> initial seed, otherwise you'd have a race condition in which the order
> of acquiring random instances could influence the test's result. This
> is not to say it's a perfect method (if there are other races there is
> nothing to be done about them) but at least it's something.
>
> Which TestSort are we talking about because there seem to be three of them...

This one:
   lucene/core/src/test/org/apache/lucene/search/TestSort.java

Andi..

Mime
View raw message