serhiy-bzhezytskyy commented on code in PR #4632:
URL: https://github.com/apache/solr/pull/4632#discussion_r3573799871
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateBaseSolrClient.java:
##########
@@ -187,6 +221,51 @@ protected ConcurrentUpdateBaseSolrClient(Builder builder) {
/** Class representing an UpdateRequest and an optional collection. */
protected record Update(UpdateRequest request, String collection) {}
+ /**
+ * The result of sending one or more updates as a single stream: the
response to await, plus the
+ * ids of the documents actually sent and their collection. A transport may
coalesce several
+ * queued updates into one stream (e.g. the Jetty client), so it reports the
ids of all of them
+ * here -- letting the error handler learn every failed document, not just
the first. Only ids are
+ * retained (see {@link UpdateErrorHandler#extractId}), preserving streaming
memory efficiency;
+ * the list is empty when no error handler is registered. Subclasses build
this via {@link
+ * #sentStream}.
+ */
+ protected record SentStream(StreamingResponse response, List<String> docIds,
String collection) {}
+
+ /** Factory for {@link SentStream}, callable by {@link #doSendUpdateStream}
implementations. */
+ protected static SentStream sentStream(
+ StreamingResponse response, List<String> docIds, String collection) {
+ return new SentStream(response, docIds, collection);
+ }
+
+ /** True when an error handler is registered, so transports skip id
extraction otherwise. */
+ protected boolean hasErrorHandler() {
+ return errorHandler != null;
+ }
+
+ /** Extracts a document id via the registered handler (defaults to the
{@code id} field). */
+ protected String extractId(SolrInputDocument doc) {
+ return errorHandler == null ? null : errorHandler.extractId(doc);
+ }
Review Comment:
Delegate removed; helper renamed idsForErrorReporting with the
empty-when-no-handler contract documented.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateBaseSolrClient.java:
##########
@@ -187,6 +221,51 @@ protected ConcurrentUpdateBaseSolrClient(Builder builder) {
/** Class representing an UpdateRequest and an optional collection. */
protected record Update(UpdateRequest request, String collection) {}
+ /**
+ * The result of sending one or more updates as a single stream: the
response to await, plus the
+ * ids of the documents actually sent and their collection. A transport may
coalesce several
+ * queued updates into one stream (e.g. the Jetty client), so it reports the
ids of all of them
+ * here -- letting the error handler learn every failed document, not just
the first. Only ids are
+ * retained (see {@link UpdateErrorHandler#extractId}), preserving streaming
memory efficiency;
+ * the list is empty when no error handler is registered. Subclasses build
this via {@link
+ * #sentStream}.
+ */
+ protected record SentStream(StreamingResponse response, List<String> docIds,
String collection) {}
+
+ /** Factory for {@link SentStream}, callable by {@link #doSendUpdateStream}
implementations. */
+ protected static SentStream sentStream(
+ StreamingResponse response, List<String> docIds, String collection) {
+ return new SentStream(response, docIds, collection);
+ }
+
+ /** True when an error handler is registered, so transports skip id
extraction otherwise. */
+ protected boolean hasErrorHandler() {
+ return errorHandler != null;
+ }
+
+ /** Extracts a document id via the registered handler (defaults to the
{@code id} field). */
+ protected String extractId(SolrInputDocument doc) {
+ return errorHandler == null ? null : errorHandler.extractId(doc);
+ }
+
+ /**
+ * The ids of a request's documents, for failure reporting. Empty when no
error handler is
+ * registered (so the documents are never read), preserving streaming memory
efficiency.
+ */
+ protected List<String> docIds(UpdateRequest request) {
+ if (errorHandler == null || request.getDocuments() == null) {
+ return List.of();
+ }
Review Comment:
Delegate removed; helper renamed idsForErrorReporting with the
empty-when-no-handler contract documented.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]