mirror of https://github.com/apache/lucene.git
Use getAndSet, getAndClear instead split operations. (#13507)
This commit is contained in:
parent
937c004eda
commit
057cbf3c86
|
@ -70,9 +70,8 @@ final class FreqProxTermsWriter extends TermsHash {
|
|||
state.liveDocs = new FixedBitSet(state.segmentInfo.maxDoc());
|
||||
state.liveDocs.set(0, state.segmentInfo.maxDoc());
|
||||
}
|
||||
if (state.liveDocs.get(doc)) {
|
||||
if (state.liveDocs.getAndClear(doc)) {
|
||||
state.delCountOnFlush++;
|
||||
state.liveDocs.clear(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,9 +97,8 @@ class PendingDeletes {
|
|||
+ info.info.name
|
||||
+ " maxDoc="
|
||||
+ info.info.maxDoc();
|
||||
final boolean didDelete = mutableBits.get(docID);
|
||||
final boolean didDelete = mutableBits.getAndClear(docID);
|
||||
if (didDelete) {
|
||||
mutableBits.clear(docID);
|
||||
pendingDeleteCount++;
|
||||
}
|
||||
return didDelete;
|
||||
|
|
|
@ -53,8 +53,7 @@ final class PendingSoftDeletes extends PendingDeletes {
|
|||
FixedBitSet mutableBits = getMutableBits();
|
||||
// hardDeletes
|
||||
if (hardDeletes.delete(docID)) {
|
||||
if (mutableBits.get(docID)) { // delete it here too!
|
||||
mutableBits.clear(docID);
|
||||
if (mutableBits.getAndClear(docID)) { // delete it here too!
|
||||
assert hardDeletes.delete(docID) == false;
|
||||
} else {
|
||||
// if it was deleted subtract the delCount
|
||||
|
@ -135,16 +134,14 @@ final class PendingSoftDeletes extends PendingDeletes {
|
|||
: null;
|
||||
while ((docID = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
|
||||
if (hasValue == null || hasValue.hasValue()) {
|
||||
if (bits.get(docID)) { // doc is live - clear it
|
||||
bits.clear(docID);
|
||||
if (bits.getAndClear(docID)) { // doc is live - clear it
|
||||
newDeletes++;
|
||||
// now that we know we deleted it and we fully control the hard deletes we can do correct
|
||||
// accounting
|
||||
// below.
|
||||
}
|
||||
} else {
|
||||
if (bits.get(docID) == false) {
|
||||
bits.set(docID);
|
||||
if (bits.getAndSet(docID) == false) {
|
||||
newDeletes--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,8 +276,7 @@ abstract class PointInSetIncludingScoreQuery extends Query implements Accountabl
|
|||
if (cmp == 0) {
|
||||
// Query point equals index point, so collect and return
|
||||
if (multipleValuesPerDocument) {
|
||||
if (result.get(docID) == false) {
|
||||
result.set(docID);
|
||||
if (result.getAndSet(docID) == false) {
|
||||
scores[docID] = nextScore;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -281,9 +281,8 @@ class TermsIncludingScoreQuery extends Query implements Accountable {
|
|||
matchingDocs.set(doc);
|
||||
}*/
|
||||
// But this behaves the same as MVInnerScorer and only then the tests will pass:
|
||||
if (!matchingDocs.get(doc)) {
|
||||
if (!matchingDocs.getAndSet(doc)) {
|
||||
scores[doc] = score;
|
||||
matchingDocs.set(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue