Skip to content

Commit 9665a20

Browse files
authored
HDDS-14156. Replace ByteArrayCodec with CodecBufferCodec in FSORepairTool (#9500)
1 parent f0ba16b commit 9665a20

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/om/FSORepairTool.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
import org.apache.hadoop.hdds.conf.ConfigurationSource;
3131
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
3232
import org.apache.hadoop.hdds.utils.db.BatchOperation;
33-
import org.apache.hadoop.hdds.utils.db.ByteArrayCodec;
33+
import org.apache.hadoop.hdds.utils.db.CodecBuffer;
34+
import org.apache.hadoop.hdds.utils.db.CodecBufferCodec;
3435
import org.apache.hadoop.hdds.utils.db.DBStore;
3536
import org.apache.hadoop.hdds.utils.db.DBStoreBuilder;
3637
import org.apache.hadoop.hdds.utils.db.StringCodec;
@@ -86,7 +87,6 @@ public class FSORepairTool extends RepairTool {
8687
private static final Logger LOG = LoggerFactory.getLogger(FSORepairTool.class);
8788
private static final String REACHABLE_TABLE = "reachable";
8889
private static final String PENDING_TO_DELETE_TABLE = "pendingToDelete";
89-
private static final byte[] EMPTY_BYTE_ARRAY = {};
9090

9191
@CommandLine.Option(names = {"--db"},
9292
required = true,
@@ -133,8 +133,8 @@ private class Impl {
133133
private final Table<String, RepeatedOmKeyInfo> deletedTable;
134134
private final Table<String, SnapshotInfo> snapshotInfoTable;
135135
private DBStore tempDB;
136-
private Table<String, byte[]> reachableTable;
137-
private Table<String, byte[]> pendingToDeleteTable;
136+
private Table<String, CodecBuffer> reachableTable;
137+
private Table<String, CodecBuffer> pendingToDeleteTable;
138138
private final ReportStatistics reachableStats;
139139
private final ReportStatistics pendingToDeleteStats;
140140
private final ReportStatistics orphanedStats;
@@ -553,7 +553,7 @@ private Collection<String> getChildDirectoriesAndMarkAsPendingToDelete(String di
553553
private void addReachableEntry(OmVolumeArgs volume, OmBucketInfo bucket, WithObjectID object) throws IOException {
554554
String reachableKey = buildReachableKey(volume, bucket, object);
555555
// No value is needed for this table.
556-
reachableTable.put(reachableKey, EMPTY_BYTE_ARRAY);
556+
reachableTable.put(reachableKey, CodecBuffer.getEmptyBuffer());
557557
}
558558

559559
/**
@@ -562,7 +562,7 @@ private void addReachableEntry(OmVolumeArgs volume, OmBucketInfo bucket, WithObj
562562
*/
563563
private void addPendingToDeleteEntry(String originalKey) throws IOException {
564564
// No value is needed for this table.
565-
pendingToDeleteTable.put(originalKey, EMPTY_BYTE_ARRAY);
565+
pendingToDeleteTable.put(originalKey, CodecBuffer.getEmptyBuffer());
566566
}
567567

568568
/**
@@ -598,8 +598,8 @@ private void openTempDB() throws IOException {
598598
.addTable(REACHABLE_TABLE)
599599
.addTable(PENDING_TO_DELETE_TABLE)
600600
.build();
601-
reachableTable = tempDB.getTable(REACHABLE_TABLE, StringCodec.get(), ByteArrayCodec.get());
602-
pendingToDeleteTable = tempDB.getTable(PENDING_TO_DELETE_TABLE, StringCodec.get(), ByteArrayCodec.get());
601+
reachableTable = tempDB.getTable(REACHABLE_TABLE, StringCodec.get(), CodecBufferCodec.get(true));
602+
pendingToDeleteTable = tempDB.getTable(PENDING_TO_DELETE_TABLE, StringCodec.get(), CodecBufferCodec.get(true));
603603
}
604604

605605
private void closeTempDB() throws IOException {

0 commit comments

Comments
 (0)