adoroszlai commented on code in PR #4789:
URL: https://github.com/apache/ozone/pull/4789#discussion_r1210075649
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/SchemaOneChunkInfoListCodec.java:
##########
@@ -43,38 +39,13 @@
* future, callers should be aware that the associated chunk information may
not
* always be present.
*/
-public final class SchemaOneChunkInfoListCodec implements Codec<ChunkInfoList>
{
-
- private static final Codec<ChunkInfoList> INSTANCE =
- new SchemaOneChunkInfoListCodec();
-
+public final class SchemaOneChunkInfoListCodec {
+ /** @return {@link ChunkInfoList#getCodec()}. */
public static Codec<ChunkInfoList> get() {
- return INSTANCE;
+ return ChunkInfoList.getCodec();
}
private SchemaOneChunkInfoListCodec() {
// singleton
}
-
- @Override
- public byte[] toPersistedFormat(ChunkInfoList chunkList) {
- return chunkList.getProtoBufMessage().toByteArray();
- }
-
- @Override
- public ChunkInfoList fromPersistedFormat(byte[] rawData) throws IOException {
- try {
- return ChunkInfoList.getFromProtoBuf(
- ContainerProtos.ChunkInfoList.parseFrom(rawData));
- } catch (InvalidProtocolBufferException ex) {
- throw new IOException("Invalid chunk information. " +
- "This data may have been written using datanode " +
- "schema version one, which did not save chunk information.", ex);
- }
Review Comment:
When implementing HDDS-8559 I kept this separate, mostly duplicated class
due to the difference in this exception handling. Code compiles fine because
`InvalidProtocolBufferException` is an `IOException`, but are you sure it has
the same behavior after the change? (I'm not sure it's covered by tests.)
--
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]