You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2023/05/26 12:11:09 UTC
[GitHub] [ozone] adoroszlai commented on a diff in pull request #4769: HDDS-8560. TypedTable should store key/value codecs in its fields.
adoroszlai commented on code in PR #4769:
URL: https://github.com/apache/ozone/pull/4769#discussion_r1206677066
##########
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:
It's not new in the patch, but I've just noticed: I think `return` is missing from the `if` block.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org