Skip to content

Commit

Permalink
Allow field usage tracker to be concurrent accessed (elastic#79088)
Browse files Browse the repository at this point in the history
While Lucene readers are currently only sequentially accessed, we expect future usages (and custom plugins) to access this concurrently.

Closes elastic#78899
  • Loading branch information
ywelsch committed Oct 14, 2021
1 parent 05b52de commit 1febcbe
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,24 @@ static class InternalFieldStats {
}

static class PerField {
boolean terms;
boolean postings;
boolean termFrequencies;
boolean positions;
boolean offsets;
boolean docValues;
boolean storedFields;
boolean norms;
boolean payloads;
boolean termVectors;
boolean points;
// while these fields are currently only sequentially accessed, we expect concurrent access by future usages (and custom plugins)
volatile boolean terms;
volatile boolean postings;
volatile boolean termFrequencies;
volatile boolean positions;
volatile boolean offsets;
volatile boolean docValues;
volatile boolean storedFields;
volatile boolean norms;
volatile boolean payloads;
volatile boolean termVectors;
volatile boolean points;
}

public class FieldUsageStatsTrackingSession implements FieldUsageNotifier, Releasable {

private final Map<String, PerField> usages = new HashMap<>();
// while this map is currently only sequentially accessed, we expect future usages (and custom plugins) to access this concurrently
private final Map<String, PerField> usages = new ConcurrentHashMap<>();

@Override
public void close() {
Expand Down

0 comments on commit 1febcbe

Please sign in to comment.