guihecheng commented on a change in pull request #3253:
URL: https://github.com/apache/ozone/pull/3253#discussion_r839218031



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeSchemaThreeDBDefinition.java
##########
@@ -0,0 +1,136 @@
+/*
+ * 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 com.google.common.primitives.Longs;
+import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction;
+import org.apache.hadoop.hdds.utils.db.DBColumnFamilyDefinition;
+import org.apache.hadoop.hdds.utils.db.FixedLengthStringUtils;
+import org.apache.hadoop.hdds.utils.db.LongCodec;
+import org.apache.hadoop.hdds.utils.db.PrefixedStringCodec;
+import org.apache.hadoop.ozone.container.common.helpers.BlockData;
+import org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList;
+import org.apache.hadoop.ozone.container.common.utils.db.DatanodeDBProfile;
+import org.rocksdb.ColumnFamilyOptions;
+
+import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DB_PROFILE;
+import static 
org.apache.hadoop.hdds.utils.db.DBStoreBuilder.HDDS_DEFAULT_DB_PROFILE;
+
+/**
+ * This class defines the RocksDB structure for datanode following schema
+ * version 3, where the block data, metadata, and transactions which are to be
+ * deleted are put in their own separate column families and with containerID
+ * as key prefix.
+ */
+public class DatanodeSchemaThreeDBDefinition
+    extends AbstractDatanodeDBDefinition {
+  public static final DBColumnFamilyDefinition<String, BlockData>
+      BLOCK_DATA =
+      new DBColumnFamilyDefinition<>(
+          "block_data",
+          String.class,
+          new PrefixedStringCodec(),

Review comment:
       Hmmm, I think there are mainly 2 concerns here:
   1. The difference between the key format of schema 2 and 3 should be 
explained some here, I prefer to add comments above both the 2 classes to do so 
rather than by renaming certain classes.
   2. Choosing a name for the Codec class, here I name it a 'PrefixedString' 
because we have a fixed-length prefix within each key for this new schema. But 
the `ASCIIStringCodec` is not so good to me, my reason is the `StringCodec` is 
not named `UTF8StringCodec` but just `StringCodec` since the key type is just 
String, so the Codec name don't have to reveal the low-level encoding which the 
caller of this DBDefinition classes don't actually cares.




-- 
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]

Reply via email to