Performance fix. Reduce deprecation calls for the same bulk request (#37415)
DeprecationLogger has warning de-duplication logic but it is expensive to run as it involves parsing existing warning headers. This PR changes the upstream bulk indexing code to do its own "event thinning" rather than relying on DeprecationLogger's trimming. Closes #37411
This commit is contained in:
parent
2ee55a50bf
commit
92c6c98e8d
|
@ -366,6 +366,7 @@ public class BulkRequest extends ActionRequest implements CompositeIndicesReques
|
|||
int from = 0;
|
||||
int length = data.length();
|
||||
byte marker = xContent.streamSeparator();
|
||||
boolean typesDeprecationLogged = false;
|
||||
while (true) {
|
||||
int nextMarker = findNextMarker(marker, from, data, length);
|
||||
if (nextMarker == -1) {
|
||||
|
@ -427,7 +428,10 @@ public class BulkRequest extends ActionRequest implements CompositeIndicesReques
|
|||
}
|
||||
index = parser.text();
|
||||
} else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
deprecationLogger.deprecatedAndMaybeLog("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
|
||||
if (typesDeprecationLogged == false) {
|
||||
deprecationLogger.deprecatedAndMaybeLog("bulk_with_types", RestBulkAction.TYPES_DEPRECATION_MESSAGE);
|
||||
typesDeprecationLogged = true;
|
||||
}
|
||||
type = parser.text();
|
||||
} else if (ID.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
id = parser.text();
|
||||
|
|
Loading…
Reference in New Issue