This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 69e3cf3505 HDDS-8541. CodecRegistry is not thread safe. (#4658)
69e3cf3505 is described below
commit 69e3cf35058759447920796968e3b23cda7ee327
Author: Tsz-Wo Nicholas Sze <[email protected]>
AuthorDate: Fri May 5 01:51:03 2023 -0700
HDDS-8541. CodecRegistry is not thread safe. (#4658)
---
.../apache/hadoop/hdds/utils/db/CodecRegistry.java | 67 +++++++++++-----------
.../hadoop/hdds/utils/db/DBStoreBuilder.java | 5 +-
.../org/apache/hadoop/hdds/utils/db/RDBStore.java | 10 ----
.../hadoop/hdds/utils/TestRDBSnapshotProvider.java | 15 +++--
.../apache/hadoop/hdds/utils/db/TestRDBStore.java | 16 +++++-
.../hadoop/hdds/utils/db/TestRDBTableStore.java | 2 +-
.../hdds/utils/db/TestTypedRDBTableStore.java | 4 +-
.../apache/hadoop/ozone/om/OmSnapshotManager.java | 9 +--
.../om/service/TestSnapshotDiffCleanupService.java | 10 ++--
.../om/snapshot/TestRocksDbPersistentList.java | 4 +-
.../om/snapshot/TestRocksDbPersistentMap.java | 2 +-
.../om/snapshot/TestRocksDbPersistentSet.java | 2 +-
.../recon/recovery/ReconOmMetadataManagerImpl.java | 3 +-
13 files changed, 72 insertions(+), 77 deletions(-)
diff --git
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/CodecRegistry.java
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/CodecRegistry.java
index 2d5da45e8f..de9c596808 100644
---
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/CodecRegistry.java
+++
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/CodecRegistry.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hdds.utils.db;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
@@ -30,16 +31,35 @@ import org.apache.commons.lang3.ClassUtils;
/**
* Collection of available codecs.
+ * This class is immutable.
*/
-public class CodecRegistry {
+public final class CodecRegistry {
+ /** To build {@link CodecRegistry}. */
+ public static class Builder {
+ private final Map<Class<?>, Codec<?>> codecs = new HashMap<>();
- private Map<Class, Codec<?>> valueCodecs;
+ public <T> Builder addCodec(Class<T> type, Codec<T> codec) {
+ codecs.put(type, codec);
+ return this;
+ }
+
+ public CodecRegistry build() {
+ return new CodecRegistry(codecs);
+ }
+ }
+
+ public static Builder newBuilder() {
+ return new Builder()
+ .addCodec(String.class, new StringCodec())
+ .addCodec(Long.class, new LongCodec())
+ .addCodec(Integer.class, new IntegerCodec())
+ .addCodec(byte[].class, new ByteArrayCodec());
+ }
+
+ private final Map<Class<?>, Codec<?>> valueCodecs;
- public CodecRegistry() {
- valueCodecs = new HashMap<>();
- valueCodecs.put(String.class, new StringCodec());
- valueCodecs.put(Long.class, new LongCodec());
- valueCodecs.put(byte[].class, new ByteArrayCodec());
+ private CodecRegistry(Map<Class<?>, Codec<?>> valueCodecs) {
+ this.valueCodecs = Collections.unmodifiableMap(new HashMap<>(valueCodecs));
}
/**
@@ -55,8 +75,7 @@ public class CodecRegistry {
if (rawData == null) {
return null;
}
- Codec codec = getCodec(format);
- return (T) codec.fromPersistedFormat(rawData);
+ return getCodec(format).fromPersistedFormat(rawData);
}
/**
@@ -65,14 +84,12 @@ public class CodecRegistry {
* @param format
* @param <T>
* @return new object copied from the given object.
- * @throws IOException
*/
- public <T> T copyObject(T object, Class<T> format) throws IOException {
+ public <T> T copyObject(T object, Class<T> format) {
if (object == null) {
return null;
}
- Codec codec = getCodec(format);
- return (T) codec.copyObject(object);
+ return getCodec(format).copyObject(object);
}
/**
@@ -93,9 +110,8 @@ public class CodecRegistry {
* Get codec for the typed object including class and subclass.
* @param object typed object.
* @return Codec for the typed object.
- * @throws IOException
*/
- private <T> Codec getCodec(T object) throws IOException {
+ public <T> Codec<T> getCodec(T object) {
Class<T> format = (Class<T>) object.getClass();
return getCodec(format);
}
@@ -105,32 +121,19 @@ public class CodecRegistry {
* Get codec for the typed object including class and subclass.
* @param <T> Type of the typed object.
* @return Codec for the typed object.
- * @throws IOException
*/
- private <T> Codec getCodec(Class<T> format) throws IOException {
- Codec<T> codec;
+ private <T> Codec<T> getCodec(Class<T> format) {
final List<Class<?>> classes = new ArrayList<>();
classes.add(format);
classes.addAll(ClassUtils.getAllSuperclasses(format));
classes.addAll(ClassUtils.getAllInterfaces(format));
for (Class<?> clazz : classes) {
- if (valueCodecs.containsKey(clazz)) {
- return (Codec<T>) valueCodecs.get(clazz);
+ final Codec<?> codec = valueCodecs.get(clazz);
+ if (codec != null) {
+ return (Codec<T>) codec;
}
}
throw new IllegalStateException(
"Codec is not registered for type: " + format);
}
-
- /**
- * Addds codec to the internal collection.
- *
- * @param type Type of the codec source/destination object.
- * @param codec The codec itself.
- * @param <T> The type of the codec
- */
- public <T> void addCodec(Class<T> type, Codec<T> codec) {
- valueCodecs.put(type, codec);
- }
-
}
diff --git
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
index c7a436230c..93d507de8e 100644
---
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
+++
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java
@@ -90,7 +90,7 @@ public final class DBStoreBuilder {
// any options. On build, this will be replaced with defaultCfOptions.
private Map<String, ManagedColumnFamilyOptions> cfOptions;
private ConfigurationSource configuration;
- private CodecRegistry registry;
+ private final CodecRegistry.Builder registry = CodecRegistry.newBuilder();
private String rocksDbStat;
// RocksDB column family write buffer size
private long rocksDbCfWriteBufferSize;
@@ -136,7 +136,6 @@ public final class DBStoreBuilder {
RocksDBConfiguration rocksDBConfiguration) {
cfOptions = new HashMap<>();
this.configuration = configuration;
- this.registry = new CodecRegistry();
this.rocksDbStat = configuration.getTrimmed(
OZONE_METADATA_STORE_ROCKSDB_STATISTICS,
OZONE_METADATA_STORE_ROCKSDB_STATISTICS_DEFAULT);
@@ -210,7 +209,7 @@ public final class DBStoreBuilder {
}
return new RDBStore(dbFile, rocksDBOption, writeOptions, tableConfigs,
- registry, openReadOnly, maxFSSnapshots, dbJmxBeanNameName,
+ registry.build(), openReadOnly, maxFSSnapshots, dbJmxBeanNameName,
enableCompactionLog, maxDbUpdatesSizeThreshold, createCheckpointDirs,
configuration);
} finally {
diff --git
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
index 7b0d210856..ca2b6743d6 100644
---
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
+++
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java
@@ -79,16 +79,6 @@ public class RDBStore implements DBStore {
// number in request to avoid increase in heap memory.
private long maxDbUpdatesSizeThreshold;
- @VisibleForTesting
- public RDBStore(File dbFile, ManagedDBOptions options,
- Set<TableConfig> families,
- long maxDbUpdatesSizeThreshold)
- throws IOException {
- this(dbFile, options, new ManagedWriteOptions(), families,
- new CodecRegistry(), false, 1000, null, false,
- maxDbUpdatesSizeThreshold, true, null);
- }
-
@SuppressWarnings("parameternumber")
public RDBStore(File dbFile, ManagedDBOptions dbOptions,
ManagedWriteOptions writeOptions, Set<TableConfig> families,
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/TestRDBSnapshotProvider.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/TestRDBSnapshotProvider.java
index 3fcb53da14..48f7745dba 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/TestRDBSnapshotProvider.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/TestRDBSnapshotProvider.java
@@ -54,6 +54,7 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static
org.apache.hadoop.hdds.utils.HddsServerUtil.writeDBCheckpointToStream;
+import static org.apache.hadoop.hdds.utils.db.TestRDBStore.newRDBStore;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -92,7 +93,7 @@ public class TestRDBSnapshotProvider {
configSet.add(newConfig);
}
testDir = tempDir;
- rdbStore = new RDBStore(tempDir, options, configSet,
+ rdbStore = newRDBStore(tempDir, options, configSet,
MAX_DB_UPDATES_SIZE_THRESHOLD);
rdbSnapshotProvider = new RDBSnapshotProvider(testDir, "test.db") {
@Override
@@ -177,20 +178,22 @@ public class TestRDBSnapshotProvider {
public void compareDB(File db1, File db2, int columnFamilyUsed)
throws Exception {
- try (RDBStore rdbStore1 = new RDBStore(db1, getNewDBOptions(),
+ try (RDBStore rdbStore1 = newRDBStore(db1, getNewDBOptions(),
configSet, MAX_DB_UPDATES_SIZE_THRESHOLD);
- RDBStore rdbStore2 = new RDBStore(db2, getNewDBOptions(),
+ RDBStore rdbStore2 = newRDBStore(db2, getNewDBOptions(),
configSet, MAX_DB_UPDATES_SIZE_THRESHOLD)) {
// all entries should be same from two DB
for (int i = 0; i < columnFamilyUsed; i++) {
+ final String name = families.get(i);
+ final Table<byte[], byte[]> table1 = rdbStore1.getTable(name);
+ final Table<byte[], byte[]> table2 = rdbStore2.getTable(name);
try (TableIterator<byte[], ? extends KeyValue<byte[], byte[]>> iterator
- = rdbStore1.getTable(families.get(i)).iterator()) {
+ = table1.iterator()) {
while (iterator.hasNext()) {
KeyValue<byte[], byte[]> keyValue = iterator.next();
byte[] key = keyValue.getKey();
byte[] value1 = keyValue.getValue();
- byte[] value2 = rdbStore2.getTable(families.get(i))
- .getIfExist(key);
+ byte[] value2 = table2.getIfExist(key);
assertArrayEquals(value1, value2);
}
}
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
index 0a9e220597..a939531471 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBStore.java
@@ -38,6 +38,7 @@ import org.apache.hadoop.hdds.StringUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.hadoop.hdds.utils.db.managed.ManagedColumnFamilyOptions;
import org.apache.hadoop.hdds.utils.db.managed.ManagedDBOptions;
+import org.apache.hadoop.hdds.utils.db.managed.ManagedWriteOptions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -53,6 +54,15 @@ import static
org.apache.hadoop.ozone.OzoneConsts.ROCKSDB_SST_SUFFIX;
* RDBStore Tests.
*/
public class TestRDBStore {
+ public static RDBStore newRDBStore(File dbFile, ManagedDBOptions options,
+ Set<TableConfig> families,
+ long maxDbUpdatesSizeThreshold)
+ throws IOException {
+ return new RDBStore(dbFile, options, new ManagedWriteOptions(), families,
+ CodecRegistry.newBuilder().build(), false, 1000, null, false,
+ maxDbUpdatesSizeThreshold, true, null);
+ }
+
public static final int MAX_DB_UPDATES_SIZE_THRESHOLD = 80;
private final List<String> families =
Arrays.asList(StringUtils.bytes2String(RocksDB.DEFAULT_COLUMN_FAMILY),
@@ -78,7 +88,7 @@ public class TestRDBStore {
new ManagedColumnFamilyOptions());
configSet.add(newConfig);
}
- rdbStore = new RDBStore(tempDir, options, configSet,
+ rdbStore = newRDBStore(tempDir, options, configSet,
MAX_DB_UPDATES_SIZE_THRESHOLD);
}
@@ -244,7 +254,7 @@ public class TestRDBStore {
Assertions.assertNotNull(checkpoint);
RDBStore restoredStoreFromCheckPoint =
- new RDBStore(checkpoint.getCheckpointLocation().toFile(),
+ newRDBStore(checkpoint.getCheckpointLocation().toFile(),
options, configSet, MAX_DB_UPDATES_SIZE_THRESHOLD);
// Let us make sure that our estimate is not off by 10%
@@ -348,7 +358,7 @@ public class TestRDBStore {
new ManagedColumnFamilyOptions());
configSet.add(newConfig);
}
- rdbStore = new RDBStore(rdbStore.getDbLocation(), options, configSet,
+ rdbStore = newRDBStore(rdbStore.getDbLocation(), options, configSet,
MAX_DB_UPDATES_SIZE_THRESHOLD);
for (String family : familiesMinusOne) {
try (Table table = rdbStore.getTable(family)) {
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBTableStore.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBTableStore.java
index b52d5779dc..812aab4b60 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBTableStore.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestRDBTableStore.java
@@ -114,7 +114,7 @@ public class TestRDBTableStore {
TableConfig newConfig = new TableConfig(name, cfOptions);
configSet.add(newConfig);
}
- rdbStore = new RDBStore(tempDir, options, configSet,
+ rdbStore = TestRDBStore.newRDBStore(tempDir, options, configSet,
MAX_DB_UPDATES_SIZE_THRESHOLD);
}
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestTypedRDBTableStore.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestTypedRDBTableStore.java
index c6e07a7a99..ad1c03b868 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestTypedRDBTableStore.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/utils/db/TestTypedRDBTableStore.java
@@ -79,10 +79,10 @@ public class TestTypedRDBTableStore {
new ManagedColumnFamilyOptions());
configSet.add(newConfig);
}
- rdbStore = new RDBStore(tempDir, options, configSet,
+ rdbStore = TestRDBStore.newRDBStore(tempDir, options, configSet,
MAX_DB_UPDATES_SIZE_THRESHOLD);
- codecRegistry = new CodecRegistry();
+ codecRegistry = CodecRegistry.newBuilder().build();
}
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
index 9f1a2747f2..8696d44c1c 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java
@@ -42,7 +42,6 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.server.ServerUtils;
import org.apache.hadoop.hdds.utils.db.CodecRegistry;
import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
-import org.apache.hadoop.hdds.utils.db.IntegerCodec;
import org.apache.hadoop.hdds.utils.db.RDBStore;
import org.apache.hadoop.hdds.utils.db.RocksDatabase;
import org.apache.hadoop.hdds.utils.db.Table;
@@ -325,17 +324,13 @@ public final class OmSnapshotManager implements
AutoCloseable {
}
private CodecRegistry createCodecRegistryForSnapDiff() {
- CodecRegistry registry = new CodecRegistry();
-
- // Integers are used for indexing persistent list.
- registry.addCodec(Integer.class, new IntegerCodec());
+ final CodecRegistry.Builder registry = CodecRegistry.newBuilder();
// DiffReportEntry codec for Diff Report.
registry.addCodec(SnapshotDiffReportOzone.DiffReportEntry.class,
new OmDBDiffReportEntryCodec());
registry.addCodec(SnapshotDiffJob.class,
new SnapshotDiffJob.SnapshotDiffJobCodec());
-
- return registry;
+ return registry.build();
}
/**
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestSnapshotDiffCleanupService.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestSnapshotDiffCleanupService.java
index eb7b77f328..3240900310 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestSnapshotDiffCleanupService.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestSnapshotDiffCleanupService.java
@@ -22,7 +22,6 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.hadoop.hdds.StringUtils;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.utils.db.CodecRegistry;
-import org.apache.hadoop.hdds.utils.db.IntegerCodec;
import org.apache.hadoop.hdds.utils.db.managed.ManagedColumnFamilyOptions;
import org.apache.hadoop.hdds.utils.db.managed.ManagedDBOptions;
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB;
@@ -163,15 +162,14 @@ public class TestSnapshotDiffCleanupService {
purgedJobTableCfh = db.get().createColumnFamily(purgedJobTableCfd);
reportTableCfh = db.get().createColumnFamily(reportTableCfd);
- codecRegistry = new CodecRegistry();
- // Integers are used for indexing persistent list.
- codecRegistry.addCodec(Integer.class, new IntegerCodec());
+ final CodecRegistry.Builder b = CodecRegistry.newBuilder();
// DiffReportEntry codec for Diff Report.
- codecRegistry.addCodec(SnapshotDiffReportOzone.DiffReportEntry.class,
+ b.addCodec(SnapshotDiffReportOzone.DiffReportEntry.class,
new OmDBDiffReportEntryCodec());
- codecRegistry.addCodec(SnapshotDiffJob.class,
+ b.addCodec(SnapshotDiffJob.class,
new SnapshotDiffJob.SnapshotDiffJobCodec());
+ codecRegistry = b.build();
emptyReportEntry = codecRegistry.asRawData("{}");
diffCleanupService = new SnapshotDiffCleanupService(
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentList.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentList.java
index 1c6baac91b..990bdc4849 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentList.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentList.java
@@ -25,7 +25,6 @@ import java.util.Collections;
import java.util.List;
import org.apache.hadoop.hdds.StringUtils;
import org.apache.hadoop.hdds.utils.db.CodecRegistry;
-import org.apache.hadoop.hdds.utils.db.IntegerCodec;
import org.apache.hadoop.hdds.utils.db.managed.ManagedColumnFamilyOptions;
import org.apache.hadoop.hdds.utils.db.managed.ManagedDBOptions;
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB;
@@ -95,8 +94,7 @@ public class TestRocksDbPersistentList {
public void testRocksDBPersistentList() throws IOException, RocksDBException
{
ColumnFamilyHandle columnFamily = null;
try {
- CodecRegistry codecRegistry = new CodecRegistry();
- codecRegistry.addCodec(Integer.class, new IntegerCodec());
+ final CodecRegistry codecRegistry = CodecRegistry.newBuilder().build();
columnFamily = db.get().createColumnFamily(new ColumnFamilyDescriptor(
codecRegistry.asRawData("testSet"), columnFamilyOptions));
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentMap.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentMap.java
index 849b8179d4..45f71e1d60 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentMap.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentMap.java
@@ -95,7 +95,7 @@ public class TestRocksDbPersistentMap {
public void testRocksDBPersistentMap() throws IOException, RocksDBException {
ColumnFamilyHandle columnFamily = null;
try {
- CodecRegistry codecRegistry = new CodecRegistry();
+ final CodecRegistry codecRegistry = CodecRegistry.newBuilder().build();
columnFamily = db.get().createColumnFamily(new ColumnFamilyDescriptor(
codecRegistry.asRawData("testMap"), columnFamilyOptions));
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentSet.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentSet.java
index ae021c55dc..6f2248f75c 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentSet.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestRocksDbPersistentSet.java
@@ -100,7 +100,7 @@ public class TestRocksDbPersistentSet {
ColumnFamilyHandle columnFamily = null;
try {
- CodecRegistry codecRegistry = new CodecRegistry();
+ final CodecRegistry codecRegistry = CodecRegistry.newBuilder().build();
columnFamily = db.get().createColumnFamily(
new ColumnFamilyDescriptor(
codecRegistry.asRawData("testSet"), columnFamilyOptions));
diff --git
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
index 6bd1ab4751..88b6cf61c4 100644
---
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
+++
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
@@ -92,8 +92,7 @@ public class ReconOmMetadataManagerImpl extends
OmMetadataManagerImpl
.setName(dbFile.getName())
.setPath(dbFile.toPath().getParent());
addOMTablesAndCodecs(dbStoreBuilder);
- DBStore newStore = dbStoreBuilder.build();
- setStore(newStore);
+ setStore(dbStoreBuilder.build());
LOG.info("Created OM DB handle from snapshot at {}.",
dbFile.getAbsolutePath());
} catch (IOException ioEx) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]