mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-26 23:07:45 +00:00
Set the actual bytes used in circuit breaker back to how it was before loading if the loading wasn't successful.
Closes #5526
This commit is contained in:
parent
0ee889fd8b
commit
a48254a04b
@ -100,6 +100,7 @@ public class ParentChildIndexFieldData extends AbstractIndexFieldData<ParentChil
|
|||||||
ParentChildEstimator estimator = new ParentChildEstimator(breakerService.getBreaker(), termsEnum);
|
ParentChildEstimator estimator = new ParentChildEstimator(breakerService.getBreaker(), termsEnum);
|
||||||
TermsEnum estimatedTermsEnum = estimator.beforeLoad(null);
|
TermsEnum estimatedTermsEnum = estimator.beforeLoad(null);
|
||||||
ObjectObjectOpenHashMap<String, TypeBuilder> typeBuilders = ObjectObjectOpenHashMap.newInstance();
|
ObjectObjectOpenHashMap<String, TypeBuilder> typeBuilders = ObjectObjectOpenHashMap.newInstance();
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
DocsEnum docsEnum = null;
|
DocsEnum docsEnum = null;
|
||||||
for (BytesRef term = estimatedTermsEnum.next(); term != null; term = estimatedTermsEnum.next()) {
|
for (BytesRef term = estimatedTermsEnum.next(); term != null; term = estimatedTermsEnum.next()) {
|
||||||
@ -136,14 +137,18 @@ public class ParentChildIndexFieldData extends AbstractIndexFieldData<ParentChil
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
data = new ParentChildAtomicFieldData(typeToAtomicFieldData.build());
|
data = new ParentChildAtomicFieldData(typeToAtomicFieldData.build());
|
||||||
success = true;
|
|
||||||
return data;
|
|
||||||
} finally {
|
} finally {
|
||||||
for (ObjectObjectCursor<String, TypeBuilder> cursor : typeBuilders) {
|
for (ObjectObjectCursor<String, TypeBuilder> cursor : typeBuilders) {
|
||||||
cursor.value.builder.close();
|
cursor.value.builder.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
success = true;
|
||||||
|
return data;
|
||||||
|
} finally {
|
||||||
if (success) {
|
if (success) {
|
||||||
estimator.afterLoad(estimatedTermsEnum, data.getMemorySizeInBytes());
|
estimator.afterLoad(estimatedTermsEnum, data.getMemorySizeInBytes());
|
||||||
|
} else {
|
||||||
|
estimator.afterLoad(estimatedTermsEnum, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user