Skip to content

Commit c721c6d

Browse files
committed
fix: prevent containerId encode without keyVersion
1 parent b6bd60b commit c721c6d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/KeyPrefixContainerCodec.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,11 @@ public byte[] toPersistedFormat(KeyPrefixContainer keyPrefixContainer) {
156156
keyPrefixBytes = ArrayUtils.addAll(keyPrefixBytes, KEY_DELIMITER_BYTES);
157157
keyPrefixBytes = ArrayUtils.addAll(keyPrefixBytes, Longs.toByteArray(
158158
keyPrefixContainer.getKeyVersion()));
159-
}
160-
161-
if (keyPrefixContainer.getContainerId() != -1) {
162-
keyPrefixBytes = ArrayUtils.addAll(keyPrefixBytes, KEY_DELIMITER_BYTES);
163-
keyPrefixBytes = ArrayUtils.addAll(keyPrefixBytes, Longs.toByteArray(
164-
keyPrefixContainer.getContainerId()));
159+
if (keyPrefixContainer.getContainerId() != -1) {
160+
keyPrefixBytes = ArrayUtils.addAll(keyPrefixBytes, KEY_DELIMITER_BYTES);
161+
keyPrefixBytes = ArrayUtils.addAll(keyPrefixBytes, Longs.toByteArray(
162+
keyPrefixContainer.getContainerId()));
163+
}
165164
}
166165

167166
return keyPrefixBytes;

0 commit comments

Comments
 (0)