You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/04/08 16:06:23 UTC
[GitHub] [lucene-solr] mikemccand commented on a change in pull request
#637: LUCENE-8754: Prevent ConcurrentModificationException in SegmentInfo
mikemccand commented on a change in pull request #637: LUCENE-8754: Prevent ConcurrentModificationException in SegmentInfo
URL: https://github.com/apache/lucene-solr/pull/637#discussion_r273119818
##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java
##########
@@ -456,7 +456,11 @@ public String toString() {
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
PostingsWriterBase postingsWriter = new Lucene50PostingsWriter(state);
- state.segmentInfo.putAttribute(MODE_KEY, fstLoadMode.name());
+ final String previous = state.segmentInfo.putAttribute(MODE_KEY, fstLoadMode.name());
+ if (previous != null && previous.equals(fstLoadMode.name()) == false) {
+ throw new IllegalStateException("found existing value for " + MODE_KEY + " for segment: " + state.segmentInfo.name +
Review comment:
It's a little spooky that this method throws exception if you try to set the attribute to a different value than it was set before, but then does leave the new value set in the attributes?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org