szetszwo commented on code in PR #5621:
URL: https://github.com/apache/ozone/pull/5621#discussion_r1399901976
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/GrpcXceiverService.java:
##########
@@ -39,9 +46,62 @@ public class GrpcXceiverService extends
LOG = LoggerFactory.getLogger(GrpcXceiverService.class);
private final ContainerDispatcher dispatcher;
+ private final boolean zerocopyEnabled;
+ private final ZeroCopyMessageMarshaller<ContainerCommandRequestProto>
+ zeroCopyMessageMarshaller = new ZeroCopyMessageMarshaller<>(
+ ContainerCommandRequestProto.getDefaultInstance());
- public GrpcXceiverService(ContainerDispatcher dispatcher) {
+ public GrpcXceiverService(ContainerDispatcher dispatcher,
+ boolean zerocopyEnabled) {
this.dispatcher = dispatcher;
+ this.zerocopyEnabled = zerocopyEnabled;
+ }
+
+ /**
+ * Bind service with zerocopy marshaller equiped for the `send` API if
+ * zerocopy is enabled.
+ * @return service definition.
+ */
+ public ServerServiceDefinition bindServiceWithZerocopy() {
Review Comment:
Let's keep the capitalization consistent, i.e. always use `ZeroCopy` instead
of `Zerocopy`.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/GrpcXceiverService.java:
##########
@@ -39,9 +46,62 @@ public class GrpcXceiverService extends
LOG = LoggerFactory.getLogger(GrpcXceiverService.class);
private final ContainerDispatcher dispatcher;
+ private final boolean zerocopyEnabled;
+ private final ZeroCopyMessageMarshaller<ContainerCommandRequestProto>
+ zeroCopyMessageMarshaller = new ZeroCopyMessageMarshaller<>(
+ ContainerCommandRequestProto.getDefaultInstance());
- public GrpcXceiverService(ContainerDispatcher dispatcher) {
+ public GrpcXceiverService(ContainerDispatcher dispatcher,
+ boolean zerocopyEnabled) {
this.dispatcher = dispatcher;
+ this.zerocopyEnabled = zerocopyEnabled;
+ }
+
+ /**
+ * Bind service with zerocopy marshaller equiped for the `send` API if
+ * zerocopy is enabled.
+ * @return service definition.
+ */
+ public ServerServiceDefinition bindServiceWithZerocopy() {
+ ServerServiceDefinition orig = super.bindService();
+ if (!zerocopyEnabled) {
+ LOG.info("Zerocopy is not enabled.");
+ return orig;
+ }
+ if (!ZeroCopyReadinessChecker.isReady()) {
+ LOG.info("Zerocopy is not ready.");
+ return orig;
+ }
Review Comment:
Let's skip `ZeroCopyReadinessChecker`. We may safely assume grpc and
protobuf versions in Ratis always support zero copy, i.e.
`ZeroCopyReadinessChecker.isReady()` always true.
Filed https://issues.apache.org/jira/browse/RATIS-1939
--
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]