mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-26 14:54:56 +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);
|
||||
TermsEnum estimatedTermsEnum = estimator.beforeLoad(null);
|
||||
ObjectObjectOpenHashMap<String, TypeBuilder> typeBuilders = ObjectObjectOpenHashMap.newInstance();
|
||||
try {
|
||||
try {
|
||||
DocsEnum docsEnum = null;
|
||||
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());
|
||||
success = true;
|
||||
return data;
|
||||
} finally {
|
||||
for (ObjectObjectCursor<String, TypeBuilder> cursor : typeBuilders) {
|
||||
cursor.value.builder.close();
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
return data;
|
||||
} finally {
|
||||
if (success) {
|
||||
estimator.afterLoad(estimatedTermsEnum, data.getMemorySizeInBytes());
|
||||
} else {
|
||||
estimator.afterLoad(estimatedTermsEnum, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user