You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "guohao-rosicky (via GitHub)" <gi...@apache.org> on 2024/01/22 08:12:48 UTC
[PR] HDDS-10144. Zero-Copy in replication [ozone]
guohao-rosicky opened a new pull request, #6049:
URL: https://github.com/apache/ozone/pull/6049
## What changes were proposed in this pull request?
Currently zero-copy is supported in EC (write).
This PR, which is similar to [PR-5621](https://github.com/apache/ozone/pull/5621), implements zero copy for replication.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10144
## How was this patch tested?
UT
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo merged PR #6049:
URL: https://github.com/apache/ozone/pull/6049
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on code in PR #6049:
URL: https://github.com/apache/ozone/pull/6049#discussion_r1462375674
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestGrpcReplicationServiceWithZeroCopy.java:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.container.replication;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.SecurityConfig;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion;
+import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
+import org.apache.hadoop.ozone.container.common.interfaces.Handler;
+import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
+import org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
+import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+import static org.apache.hadoop.ozone.OzoneConsts.GB;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests {@link GrpcReplicationService}.
+ */
+class TestGrpcReplicationServiceWithZeroCopy {
Review Comment:
Can we combine the tests with and without zero copy enabled? Similar to what was done with `TestECKeyOutputStream` in #5621
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestGrpcReplicationServiceWithZeroCopy.java:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.container.replication;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.SecurityConfig;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion;
+import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
+import org.apache.hadoop.ozone.container.common.interfaces.Handler;
+import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
+import org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
+import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+import static org.apache.hadoop.ozone.OzoneConsts.GB;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests {@link GrpcReplicationService}.
+ */
+class TestGrpcReplicationServiceWithZeroCopy {
+
+ @TempDir
+ private Path tempDir;
+
+ private ReplicationServer replicationServer;
+ private OzoneConfiguration conf;
+
+ private DatanodeDetails datanode;
+
+ private long containerId;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ containerId = 123456L;
+ conf = new OzoneConfiguration();
+ conf.set(ReplicationServer.ReplicationConfig.PREFIX + "." +
+ ReplicationServer.ReplicationConfig.ZEROCOPY_ENABLE_KEY, "true");
Review Comment:
nit. We can use the setter from the config object here instead:
```
ReplicationServer.ReplicationConfig replicationConfig = conf.getObject(ReplicationServer.ReplicationConfig.class)
```
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestGrpcReplicationServiceWithZeroCopy.java:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.container.replication;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.SecurityConfig;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion;
+import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
+import org.apache.hadoop.ozone.container.common.interfaces.Handler;
+import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
+import org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
+import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+import static org.apache.hadoop.ozone.OzoneConsts.GB;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests {@link GrpcReplicationService}.
+ */
+class TestGrpcReplicationServiceWithZeroCopy {
+
+ @TempDir
+ private Path tempDir;
+
+ private ReplicationServer replicationServer;
+ private OzoneConfiguration conf;
+
+ private DatanodeDetails datanode;
+
+ private long containerId;
+
+ @BeforeEach
+ public void setUp() throws Exception {
+ containerId = 123456L;
+ conf = new OzoneConfiguration();
+ conf.set(ReplicationServer.ReplicationConfig.PREFIX + "." +
+ ReplicationServer.ReplicationConfig.ZEROCOPY_ENABLE_KEY, "true");
+
+ ReplicationServer.ReplicationConfig replicationConfig =
+ conf.getObject(ReplicationServer.ReplicationConfig.class);
+
+ assertTrue(replicationConfig.isZeroCopyEnable());
+
+ SecurityConfig secConf = new SecurityConfig(conf);
+
+ KeyValueContainerData data = new KeyValueContainerData(containerId,
+ ContainerLayoutVersion.FILE_PER_BLOCK, GB,
+ UUID.randomUUID().toString(), null);
+
+ KeyValueContainer container = new KeyValueContainer(data, conf);
+
+ ContainerSet containerSet = new ContainerSet(1000);
+ containerSet.addContainer(container);
+
+ DatanodeDetails.Builder dn =
+ DatanodeDetails.newBuilder().setUuid(UUID.randomUUID())
+ .setHostName("localhost").setIpAddress("127.0.0.1")
+ .setPersistedOpState(HddsProtos.NodeOperationalState.IN_SERVICE)
+ .setPersistedOpStateExpiry(0);
+ DatanodeDetails.Port containerPort =
+ DatanodeDetails.newPort(DatanodeDetails.Port.Name.STANDALONE,
+ OzoneConfigKeys.DFS_CONTAINER_IPC_PORT_DEFAULT);
+ DatanodeDetails.Port ratisPort =
+ DatanodeDetails.newPort(DatanodeDetails.Port.Name.RATIS,
+ OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_PORT_DEFAULT);
+ DatanodeDetails.Port replicationPort =
+ DatanodeDetails.newPort(DatanodeDetails.Port.Name.REPLICATION,
+ replicationConfig.getPort());
+ DatanodeDetails.Port streamPort =
+ DatanodeDetails.newPort(DatanodeDetails.Port.Name.RATIS_DATASTREAM,
+ OzoneConfigKeys.DFS_CONTAINER_RATIS_DATASTREAM_PORT_DEFAULT);
+ dn.addPort(containerPort);
+ dn.addPort(ratisPort);
+ dn.addPort(replicationPort);
+ dn.addPort(streamPort);
+
+ datanode = dn.build();
+
+ final String testDir =
+ Files.createDirectory(tempDir.resolve("VolumeDir")).toString();
+
+ MutableVolumeSet volumeSet = mock(MutableVolumeSet.class);
+ when(volumeSet.getVolumesList()).thenReturn(
+ Collections.singletonList(new HddsVolume.Builder(testDir).conf(conf).build()));
+
+ Handler containerHandler = mock(Handler.class);
+ ContainerController containerController =
+ new ContainerController(containerSet,
+ Collections.singletonMap(ContainerProtos.ContainerType.KeyValueContainer,
+ containerHandler));
+
+ ContainerImporter importer =
+ new ContainerImporter(conf, containerSet, containerController,
+ volumeSet);
+
+ replicationServer =
+ new ReplicationServer(containerController, replicationConfig, secConf,
+ null,
+ importer, datanode.threadNamePrefix());
+ replicationServer.start();
+ }
+
+ @AfterEach
+ public void cleanup() {
+ replicationServer.stop();
+ }
+
+ @Test
+ public void testZeroCopyDownload() throws IOException {
+ SimpleContainerDownloader downloader =
+ new SimpleContainerDownloader(conf, null);
+ Path downloadDir = Files.createDirectory(tempDir.resolve("DownloadDir"));
+ Path result = downloader.getContainerDataFromReplicas(containerId,
+ Collections.singletonList(datanode), downloadDir,
+ CopyContainerCompression.NO_COMPRESSION);
+
+ assertTrue(result.toString().startsWith(downloadDir.toString()));
+
+ File[] files = downloadDir.toFile().listFiles();
+
+ assertNotNull(files);
+ assertEquals(files.length, 1);
+
+ assertTrue(files[0].getName().startsWith("container-" + containerId + "-"));
+
+ downloader.close();
+ }
+
+ @Test
+ public void testZeroCopyUpload() throws IOException {
+ GrpcContainerUploader uploader =
+ new GrpcContainerUploader(conf, null);
+
+ CompletableFuture<Void> callback = new CompletableFuture<>();
+ OutputStream out = uploader.startUpload(containerId,
+ datanode, callback,
+ CopyContainerCompression.NO_COMPRESSION);
+ out.close();
Review Comment:
Shouldn't we check the upload destination to verify the file was transferred correctly?
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationServer.java:
##########
@@ -177,6 +179,11 @@ public static final class ReplicationConfig {
static final String REPLICATION_OUTOFSERVICE_FACTOR_KEY =
PREFIX + "." + OUTOFSERVICE_FACTOR_KEY;
+ public static final String ZEROCOPY_ENABLE_KEY = "zerocopy.enabled";
+ private static final boolean ZEROCOPY_ENABLE_DEFAULT = false;
Review Comment:
Any reason not to enable this by default? It will be better for testing if we turn it on in this PR.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "guohao-rosicky (via GitHub)" <gi...@apache.org>.
guohao-rosicky commented on PR #6049:
URL: https://github.com/apache/ozone/pull/6049#issuecomment-1956460251
> @guohao-rosicky do you plan to continue working on this?
I'm modifying UT. Will continue this work. @kerneltime
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on PR #6049:
URL: https://github.com/apache/ozone/pull/6049#issuecomment-1955920302
@guohao-rosicky do you plan to continue working on this?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "guohao-rosicky (via GitHub)" <gi...@apache.org>.
guohao-rosicky commented on code in PR #6049:
URL: https://github.com/apache/ozone/pull/6049#discussion_r1505631280
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SendContainerRequestHandler.java:
##########
@@ -98,6 +103,13 @@ public void onNext(SendContainerRequest req) {
nextOffset += length;
} catch (Throwable t) {
onError(t);
+ } finally {
+ if (marshaller != null) {
Review Comment:
Thanks @szetszwo for the review, modified please check.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on code in PR #6049:
URL: https://github.com/apache/ozone/pull/6049#discussion_r1462391782
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestGrpcReplicationService.java:
##########
@@ -51,7 +51,7 @@ public void copyData(long containerId, OutputStream destination,
};
ContainerImporter importer = mock(ContainerImporter.class);
GrpcReplicationService subject =
- new GrpcReplicationService(source, importer);
+ new GrpcReplicationService(source, importer, false);
Review Comment:
Why false? I think if this works well we should default to true.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #6049:
URL: https://github.com/apache/ozone/pull/6049#discussion_r1504724961
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/SendContainerRequestHandler.java:
##########
@@ -98,6 +103,13 @@ public void onNext(SendContainerRequest req) {
nextOffset += length;
} catch (Throwable t) {
onError(t);
+ } finally {
+ if (marshaller != null) {
Review Comment:
In the current code, the `marshaller` is never null. Indeed, it is a good idea to initially the marshaller objects only if zero-copy is enabled.
```java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/GrpcReplicationService.java
@@ -61,19 +61,25 @@ public class GrpcReplicationService extends
private final boolean zeroCopyEnabled;
- private final ZeroCopyMessageMarshaller<SendContainerRequest>
- sendContainerZeroCopyMessageMarshaller = new ZeroCopyMessageMarshaller<>(
- SendContainerRequest.getDefaultInstance());
+ private final ZeroCopyMessageMarshaller<SendContainerRequest> sendContainerZeroCopyMessageMarshaller;
- private final ZeroCopyMessageMarshaller<CopyContainerRequestProto>
- copyContainerZeroCopyMessageMarshaller = new ZeroCopyMessageMarshaller<>(
- CopyContainerRequestProto.getDefaultInstance());
+ private final ZeroCopyMessageMarshaller<CopyContainerRequestProto> copyContainerZeroCopyMessageMarshaller;
public GrpcReplicationService(ContainerReplicationSource source,
ContainerImporter importer, boolean zeroCopyEnabled) {
this.source = source;
this.importer = importer;
this.zeroCopyEnabled = zeroCopyEnabled;
+
+ if (zeroCopyEnabled) {
+ this.sendContainerZeroCopyMessageMarshaller = new ZeroCopyMessageMarshaller<>(
+ SendContainerRequest.getDefaultInstance());
+ this.copyContainerZeroCopyMessageMarshaller = new ZeroCopyMessageMarshaller<>(
+ CopyContainerRequestProto.getDefaultInstance());
+ } else {
+ this.sendContainerZeroCopyMessageMarshaller = null;
+ this.copyContainerZeroCopyMessageMarshaller = null;
+ }
}
public ServerServiceDefinition bindServiceWithZeroCopy() {
```
```java
@@ -148,10 +154,11 @@ public void download(CopyContainerRequestProto request,
// output may have already been closed, ignore such errors
IOUtils.cleanupWithLogger(LOG, outputStream);
- InputStream popStream =
- copyContainerZeroCopyMessageMarshaller.popStream(request);
- if (popStream != null) {
- IOUtils.cleanupWithLogger(LOG, popStream);
+ if (copyContainerZeroCopyMessageMarshaller != null) {
+ InputStream popStream = copyContainerZeroCopyMessageMarshaller.popStream(request);
+ if (popStream != null) {
+ IOUtils.cleanupWithLogger(LOG, popStream);
+ }
}
}
}
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "guohao-rosicky (via GitHub)" <gi...@apache.org>.
guohao-rosicky commented on PR #6049:
URL: https://github.com/apache/ozone/pull/6049#issuecomment-1907621580
Thanks, @kerneltime @errose28 @szetszwo for the review, everyone agrees that `zerocopy.enabled` should be a default enabled in configuration, let me change it!
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #6049:
URL: https://github.com/apache/ozone/pull/6049#discussion_r1463617825
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationServer.java:
##########
@@ -218,6 +225,15 @@ public static final class ReplicationConfig {
)
private double outOfServiceFactor = OUTOFSERVICE_FACTOR_DEFAULT;
+ @Config(key = ZEROCOPY_ENABLE_KEY,
+ type = ConfigType.BOOLEAN,
+ defaultValue = ZEROCOPY_ENABLE_DEFAULT_VALUE,
+ tags = {DATANODE, SCM},
+ description = "Specify if zero-copy should be enabled for " +
+ "replication protocol."
+ )
+ private boolean zeroCopyEnable = ZEROCOPY_ENABLE_DEFAULT;
+
Review Comment:
@guohao-rosicky , thanks a lot for working this!
Why would anyone want to disable it? Let's don't add this conf and enable it always?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10144. Zero-Copy in replication [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6049:
URL: https://github.com/apache/ozone/pull/6049#discussion_r1467273152
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestGrpcReplicationServiceWithZeroCopy.java:
##########
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.container.replication;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.SecurityConfig;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion;
+import org.apache.hadoop.ozone.container.common.impl.ContainerSet;
+import org.apache.hadoop.ozone.container.common.interfaces.Handler;
+import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
+import org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
+import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
+import org.apache.hadoop.ozone.container.ozoneimpl.ContainerController;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+import static org.apache.hadoop.ozone.OzoneConsts.GB;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests {@link GrpcReplicationService}.
+ */
+class TestGrpcReplicationServiceWithZeroCopy {
Review Comment:
I think this new class is more of an integration test. How about simply enabling zero-copy in:
https://github.com/apache/ozone/blob/2e89fcf7da904a2143d58d2a1a47e7d35983f63e/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/replication/TestContainerReplication.java#L64
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org