szetszwo commented on code in PR #4769:
URL: https://github.com/apache/ozone/pull/4769#discussion_r1206824528


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java:
##########
@@ -127,26 +144,20 @@ public void put(KEY key, VALUE value) throws IOException {
       return;
     }
 
-    byte[] keyData = codecRegistry.asRawData(key);
-    byte[] valueData = codecRegistry.asRawData(value);
-    rawTable.put(keyData, valueData);
+    rawTable.put(encodeKey(key), encodeValue(value));
   }
 
   @Override
   public void putWithBatch(BatchOperation batch, KEY key, VALUE value)
       throws IOException {
-    final Codec<KEY> keyCodec = codecRegistry.getCodec(key);
-    final Codec<VALUE> valueCodec = codecRegistry.getCodec(value);
     if (keyCodec.supportCodecBuffer() && valueCodec.supportCodecBuffer()) {
       // The buffers will be released after commit.
       rawTable.putWithBatch(batch,
           keyCodec.toDirectCodecBuffer(key),
           valueCodec.toDirectCodecBuffer(value));
     }
 
-    byte[] keyData = codecRegistry.asRawData(key);
-    byte[] valueData = codecRegistry.asRawData(value);
-    rawTable.putWithBatch(batch, keyData, valueData);
+    rawTable.putWithBatch(batch, encodeKey(key), encodeValue(value));

Review Comment:
   Good catch!  Let me add `else`.



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