Skip to content

Commit fb73265

Browse files
authored
Ensure indexing_data CCR requests are compressed (#79413)
Currently, CCR requests are not compressed if they are indexing data. This is because the BulkShardOperationsRequest does not implement the indexing data interface. Additionally, the fact that the request can be wrapped in proxy request also requires special logic. This commit implements the same logic that we do for shard indexing actions to ensure that the data is compressed if the underlying request is indexing data.
1 parent 9bec026 commit fb73265

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

server/src/main/java/org/elasticsearch/transport/TransportActionProxy.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void handleException(TransportException exp) {
9898
}
9999
}
100100

101-
static class ProxyRequest<T extends TransportRequest> extends TransportRequest {
101+
static class ProxyRequest<T extends TransportRequest> extends TransportRequest implements RawIndexingDataTransportRequest {
102102
final T wrapped;
103103
final DiscoveryNode targetNode;
104104

@@ -120,6 +120,14 @@ public void writeTo(StreamOutput out) throws IOException {
120120
targetNode.writeTo(out);
121121
wrapped.writeTo(out);
122122
}
123+
124+
@Override
125+
public boolean isRawIndexingData() {
126+
if (wrapped instanceof RawIndexingDataTransportRequest) {
127+
return ((RawIndexingDataTransportRequest) wrapped).isRawIndexingData();
128+
}
129+
return false;
130+
}
123131
}
124132

125133
private static class CancellableProxyRequest<T extends TransportRequest> extends ProxyRequest<T> {

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/bulk/BulkShardOperationsRequest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
import org.elasticsearch.common.io.stream.StreamOutput;
1212
import org.elasticsearch.index.shard.ShardId;
1313
import org.elasticsearch.index.translog.Translog;
14+
import org.elasticsearch.transport.RawIndexingDataTransportRequest;
1415

1516
import java.io.IOException;
1617
import java.util.List;
1718

18-
public final class BulkShardOperationsRequest extends ReplicatedWriteRequest<BulkShardOperationsRequest> {
19+
public final class BulkShardOperationsRequest extends ReplicatedWriteRequest<BulkShardOperationsRequest>
20+
implements RawIndexingDataTransportRequest {
1921

2022
private final String historyUUID;
2123
private final List<Translog.Operation> operations;

0 commit comments

Comments
 (0)