fapifta opened a new pull request #1596: HDDS-2233 - Remove ByteStringHelper and refactor the code to the place where it used URL: https://github.com/apache/hadoop/pull/1596 There are a couple of things in this pull request. ByteStringHelper was used in two general places, once in BlockOutputStream, and once in ChunkUtils. ChunkUtils was an easy one, as in that case the method was used directly from KeyValueHandler only, where the configuration is present. I moved the logic back to the KeyValueHandler class, and at initialization time, I created the proper converter based on the config. At this point I realized that we use byte[] type in readChunk like methods here and there, but at the end most of the usage outside is via a ByteBuffer after a ByteBuffer.wrap(byte[]) call, so I changed the readChunk logic to return a ByteBuffer instead, and used that one, with this I eliminated the need of a conversion from byte[] to ByteString. BlockOutputStream was a bit harder, as in that case, RPCClient initialized the old class with the config. The decision became the following: based on the Configuration, RPCClient already created an XCeiverClientManager that preserved a reference to the configuration, and which was already available in the BlockOutputStreamEntryPool class, that uses a BufferPool to create the buffers in BlockOutputStream, so that BlockOutputStream when does the conversion can reach it via its BufferPool. I have cleaned up one code path, that came into my way during implementation, and I removed two declared exception from ChunkUtils.readData, and with that eliminated the need for a try-catch block in the place where it is called.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
