allow to explicitly disable compression in peer recovery (defaults to true)
This commit is contained in:
parent
f6c58ff35d
commit
ee33ee457a
|
@ -74,6 +74,8 @@ public class RecoverySource extends AbstractComponent {
|
|||
|
||||
private final ByteSizeValue fileChunkSize;
|
||||
|
||||
private final boolean compress;
|
||||
|
||||
@Inject public RecoverySource(Settings settings, ThreadPool threadPool, TransportService transportService, IndicesService indicesService,
|
||||
RecoveryThrottler recoveryThrottler) {
|
||||
super(settings);
|
||||
|
@ -83,6 +85,7 @@ public class RecoverySource extends AbstractComponent {
|
|||
this.recoveryThrottler = recoveryThrottler;
|
||||
|
||||
this.fileChunkSize = componentSettings.getAsBytesSize("file_chunk_size", new ByteSizeValue(100, ByteSizeUnit.KB));
|
||||
this.compress = componentSettings.getAsBoolean("compress", true);
|
||||
|
||||
transportService.registerHandler(Actions.START_RECOVERY, new StartRecoveryTransportRequestHandler());
|
||||
}
|
||||
|
@ -165,7 +168,7 @@ public class RecoverySource extends AbstractComponent {
|
|||
long position = indexInput.getFilePointer();
|
||||
indexInput.readBytes(buf, 0, toRead, false);
|
||||
transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.FILE_CHUNK, new RecoveryFileChunkRequest(request.shardId(), name, position, len, buf, toRead),
|
||||
TransportRequestOptions.options().withCompress(), VoidTransportResponseHandler.INSTANCE).txGet();
|
||||
TransportRequestOptions.options().withCompress(compress), VoidTransportResponseHandler.INSTANCE).txGet();
|
||||
readCount += toRead;
|
||||
}
|
||||
indexInput.close();
|
||||
|
|
|
@ -45,8 +45,8 @@ public class TransportRequestOptions {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TransportRequestOptions withCompress() {
|
||||
this.compress = true;
|
||||
public TransportRequestOptions withCompress(boolean compress) {
|
||||
this.compress = compress;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
Channel targetChannel = nodeChannel(node);
|
||||
|
||||
if (compress) {
|
||||
options.withCompress();
|
||||
options.withCompress(true);
|
||||
}
|
||||
|
||||
byte[] data = TransportStreams.buildRequest(requestId, action, message, options);
|
||||
|
|
|
@ -136,7 +136,7 @@ public abstract class AbstractSimpleTransportTests {
|
|||
});
|
||||
|
||||
TransportFuture<StringMessage> res = serviceB.submitRequest(serviceANode, "sayHello",
|
||||
new StringMessage("moshe"), TransportRequestOptions.options().withCompress(), new BaseTransportResponseHandler<StringMessage>() {
|
||||
new StringMessage("moshe"), TransportRequestOptions.options().withCompress(true), new BaseTransportResponseHandler<StringMessage>() {
|
||||
@Override public StringMessage newInstance() {
|
||||
return new StringMessage();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue