Andrew Wong has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/14425 )

Change subject: KUDU-2971 p1: add subprocess module
......................................................................


Patch Set 2:

(2 comments)

Not a full review, but I'm gathering more context after bouncing between this 
patch and the java-side patch.

http://gerrit.cloudera.org:8080/#/c/14425/2/src/kudu/subprocess/subprocess_protocol.h
File src/kudu/subprocess/subprocess_protocol.h:

http://gerrit.cloudera.org:8080/#/c/14425/2/src/kudu/subprocess/subprocess_protocol.h@40
PS2, Line 40:     // Each message is serialized into a protobuf-like JSON 
representation
            :     // terminated with a newline character.
            :     JSON,
Same as with the Java-side stuff, why is it useful to send JSON over the 
subprocess cannel? We have utilities on the C++ side to print protobuf as JSON, 
and we can implement similar functions in Java.


http://gerrit.cloudera.org:8080/#/c/14425/2/src/kudu/subprocess/subprocess_protocol.cc
File src/kudu/subprocess/subprocess_protocol.cc:

http://gerrit.cloudera.org:8080/#/c/14425/2/src/kudu/subprocess/subprocess_protocol.cc@164
PS2, Line 164:
             : Status SubprocessProtocol::DoRead(faststring* buf) {
             :   uint8_t* pos = buf->data();
             :   size_t rem = buf->length();
             :   while (rem > 0) {
             :     ssize_t r;
             :     RETRY_ON_EINTR(r, read(read_fd_, pos, rem));
             :     if (r == -1) {
             :       return Status::IOError("Error reading from pipe", "", 
errno);
             :     }
             :     if (r == 0) {
             :       return Status::EndOfFile("Other end of pipe was closed");
             :     }
             :     DCHECK_GE(rem, r);
             :     rem -= r;
             :     pos += r;
             :   }
             :   return Status::OK();
             : }
             :
             : Status SubprocessProtocol::DoWrite(const faststring& buf) {
             :   const uint8_t* pos = buf.data();
             :   size_t rem = buf.length();
             :   while (rem > 0) {
             :     ssize_t r;
             :     RETRY_ON_EINTR(r, write(write_fd_, pos, rem));
             :     if (r == -1) {
             :       if (errno == EPIPE) {
             :         return Status::EndOfFile("Other end of pipe was closed");
             :       }
             :       return Status::IOError("Error writing to pipe", "", errno);
             :     }
             :     DCHECK_GE(rem, r);
             :     rem -= r;
             :     pos += r;
             :   }
             :   return Status::OK();
             : }
             :
Did you consider _only_ reusing this so we don't have to couple the subprocess 
with the CLI tool?



--
To view, visit http://gerrit.cloudera.org:8080/14425
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If73e27772e1897a04f04229c4906a24c61e361f2
Gerrit-Change-Number: 14425
Gerrit-PatchSet: 2
Gerrit-Owner: Hao Hao <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Hao Hao <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Tidy Bot (241)
Gerrit-Comment-Date: Tue, 15 Oct 2019 01:54:39 +0000
Gerrit-HasComments: Yes

Reply via email to