errose28 commented on a change in pull request #1298: URL: https://github.com/apache/hadoop-ozone/pull/1298#discussion_r482281653
########## File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/SchemaOneChunkInfoListCodec.java ########## @@ -0,0 +1,68 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.metadata; + +import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos; +import org.apache.hadoop.hdds.utils.db.Codec; +import org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList; +import org.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferException; + +import java.io.IOException; + +/** + * Codec for parsing {@link ContainerProtos.ChunkInfoList} objects from data + * that may have been written using schema version one. Before upgrading + * schema versions, deleted block IDs were stored with a duplicate copy of + * their ID as the value in the database. After upgrading the code, any + * deletes that happen on the DB will save the chunk information with the + * deleted blocks instead, even if those deletes are performed on a database + * created with schema version one. + * <p> Review comment: Because tables are now strongly typed, reads and writes to a table must have the same type, regardless of schema version. Having a different type for schema v1 and v2 tables will force callers to know which schema version they are working with, which we do not want. Therefore, since the value type of deleted block data was changed, all new reads and writes must use this type. This means the data written with the old schema version can no longer be read, but since it was just a duplicate of the key value (effectively a placeholder), this is not an issue. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org