Skip to content

Commit f242f4f

Browse files
committed
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 44b8450 commit f242f4f

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
@@ -100,7 +100,7 @@ public void handleException(TransportException exp) {
100100
}
101101
}
102102

103-
static class ProxyRequest<T extends TransportRequest> extends TransportRequest {
103+
static class ProxyRequest<T extends TransportRequest> extends TransportRequest implements RawIndexingDataTransportRequest {
104104
final T wrapped;
105105
final DiscoveryNode targetNode;
106106

@@ -122,6 +122,14 @@ public void writeTo(StreamOutput out) throws IOException {
122122
targetNode.writeTo(out);
123123
wrapped.writeTo(out);
124124
}
125+
126+
@Override
127+
public boolean isRawIndexingData() {
128+
if (wrapped instanceof RawIndexingDataTransportRequest) {
129+
return ((RawIndexingDataTransportRequest) wrapped).isRawIndexingData();
130+
}
131+
return false;
132+
}
125133
}
126134

127135
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)