chungen0126 commented on code in PR #8621:
URL: https://github.com/apache/ozone/pull/8621#discussion_r2160069350
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java:
##########
@@ -124,11 +124,11 @@ private byte[] encodeValue(VALUE value) throws
IOException {
}
private KEY decodeKey(byte[] key) throws CodecException {
- return key == null ? null : keyCodec.fromPersistedFormat(key);
+ return key != null && key.length > 0 ? keyCodec.fromPersistedFormat(key) :
null;
}
private VALUE decodeValue(byte[] value) throws CodecException {
- return value == null ? null : valueCodec.fromPersistedFormat(value);
+ return value != null && value.length > 0 ?
valueCodec.fromPersistedFormat(value) : null;
Review Comment:
Hi @szetszwo @adoroszlai, is the `value.length > 0` check necessary here?
It seems to cause an problem in
[HDDS-13302](https://issues.apache.org/jira/browse/HDDS-13302).
FSORepairTool writes zero-length byte arrays into the table when there are
reachable files/dirs.
With this check, the method returns null, making it indistinguishable from a
missing key. This means we can no longer tell whether the key exists with a
zero-length byte arrays or doesn't exist at all.
--
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]