Updated Branches: refs/heads/master 9daa5dc27 -> e3202c480
Adding some javadoc to hopefully prevent future issues. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/e3202c48 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/e3202c48 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/e3202c48 Branch: refs/heads/master Commit: e3202c480580fdfd1d8bdd5e9bcee0b0d758222c Parents: 9daa5dc Author: Aaron McCurry <[email protected]> Authored: Fri Jun 14 20:13:45 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Fri Jun 14 20:13:45 2013 -0400 ---------------------------------------------------------------------- .../blur/lucene/warmup/TraceableDirectory.java | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e3202c48/blur-store/src/main/java/org/apache/blur/lucene/warmup/TraceableDirectory.java ---------------------------------------------------------------------- diff --git a/blur-store/src/main/java/org/apache/blur/lucene/warmup/TraceableDirectory.java b/blur-store/src/main/java/org/apache/blur/lucene/warmup/TraceableDirectory.java index 638d61d..bbd99dc 100644 --- a/blur-store/src/main/java/org/apache/blur/lucene/warmup/TraceableDirectory.java +++ b/blur-store/src/main/java/org/apache/blur/lucene/warmup/TraceableDirectory.java @@ -30,6 +30,27 @@ import org.apache.lucene.store.LockFactory; public class TraceableDirectory extends Directory implements DirectoryDecorator { private final Directory _dir; + /** + * One might feel compelled to make this field volatile because of the + * massively parallel environment that Blur operates. Please do NOT! This + * field cannot be volatile for performance reasons. For every query in Lucene + * there are a number of clones made of each file handle in each segment in + * each index. If this were volatile every thread would have to check this + * field every time a clone was called (see {@link TraceableIndexInput}). In + * fact I want this field to the remain false in all cases except for when a + * warm up trace is needed. If that occurs the Thread running the actually the + * trace will set this field to true for a brief moment while all the clones + * are made and the trace is performed (the clones are also made with this + * this trace thread). After the trace is complete is will return the false. + * During the time when the field is true, if any other field actually reads + * the value as true there is a second {@link ThreadLocal} field in + * {@link IndexWarmup} that prevents any other threads from running a trace. + * However there will be a small performance penalty while that situation + * occurs, because accessing a {@link ThreadLocal} field is fairly expensive. + * + * In short please leave this the way it is, if you really want to change it + * please post a question on the mail list first. + */ private boolean _trace = false; private IndexTracer _indexTracer;
