Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ public final class OzoneConfigKeys {
"ozone.trace.enabled";
public static final boolean OZONE_TRACE_ENABLED_DEFAULT = false;

public static final String OZONE_METADATA_STORE_IMPL =
"ozone.metastore.impl";
public static final String OZONE_METADATA_STORE_IMPL_LEVELDB =
"LevelDB";
public static final String OZONE_METADATA_STORE_IMPL_ROCKSDB =
"RocksDB";
public static final String OZONE_METADATA_STORE_IMPL_DEFAULT =
OZONE_METADATA_STORE_IMPL_ROCKSDB;

public static final String OZONE_METADATA_STORE_ROCKSDB_STATISTICS =
"ozone.metastore.rocksdb.statistics";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,6 @@ private OzoneConsts() {
public static final String TRANSACTION_INFO_KEY = "#TRANSACTIONINFO";
public static final String TRANSACTION_INFO_SPLIT_KEY = "#";

public static final String CONTAINER_DB_TYPE_ROCKSDB = "RocksDB";
public static final String CONTAINER_DB_TYPE_LEVELDB = "LevelDB";
}
20 changes: 0 additions & 20 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -634,17 +634,6 @@
dfs.container.ratis.datanode.storage.dir be configured separately.
</description>
</property>
<property>
<name>ozone.metastore.impl</name>
<value>RocksDB</value>
<tag>OZONE, OM, SCM, CONTAINER, STORAGE</tag>
<description>
Ozone metadata store implementation. Ozone metadata are well
distributed to multiple services such as ozoneManager, scm. They are stored in
some local key-value databases. This property determines which database
library to use. Supported value is either LevelDB or RocksDB.
</description>
</property>

<property>
<name>ozone.metastore.rocksdb.statistics</name>
Expand Down Expand Up @@ -2291,15 +2280,6 @@
Whether to enable topology aware read to improve the read performance.
</description>
</property>
<property>
<name>ozone.recon.container.db.impl</name>
<value>RocksDB</value>
<tag>OZONE, RECON, STORAGE</tag>
<description>
Ozone Recon container DB store implementation.Supported value is either
LevelDB or RocksDB.
</description>
</property>
<property>
<name>ozone.recon.om.db.dir</name>
<value/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.hadoop.hdfs.util.Canceler;
import org.apache.hadoop.hdfs.util.DataTransferThrottler;
import org.apache.hadoop.io.nativeio.NativeIO;
import org.apache.hadoop.ozone.OzoneConfigKeys;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.container.common.helpers.ContainerUtils;
import org.apache.hadoop.ozone.container.common.impl.ContainerDataYaml;
Expand Down Expand Up @@ -129,12 +128,8 @@ public void create(VolumeSet volumeSet, VolumeChoosingPolicy
KeyValueContainerUtil.createContainerMetaData(containerMetaDataPath,
chunksPath, dbFile, config);

String impl = config.getTrimmed(OzoneConfigKeys.OZONE_METADATA_STORE_IMPL,
OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_DEFAULT);

//Set containerData for the KeyValueContainer.
containerData.setChunksPath(chunksPath.getPath());
containerData.setContainerDBType(impl);
containerData.setDbFile(dbFile);
containerData.setVolume(containerVolume);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_LEVELDB;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_ROCKSDB;
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB_TYPE_LEVELDB;
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB_TYPE_ROCKSDB;

/**
* Class to run integrity checks on Datanode Containers.
Expand Down Expand Up @@ -186,8 +186,8 @@ private void checkContainerFile() throws IOException {
}

dbType = onDiskContainerData.getContainerDBType();
if (!dbType.equals(OZONE_METADATA_STORE_IMPL_ROCKSDB) &&
!dbType.equals(OZONE_METADATA_STORE_IMPL_LEVELDB)) {
if (!dbType.equals(CONTAINER_DB_TYPE_ROCKSDB) &&
!dbType.equals(CONTAINER_DB_TYPE_LEVELDB)) {
String errStr = "Unknown DBType [" + dbType
+ "] in Container File for [" + containerID + "]";
throw new IOException(errStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.concurrent.atomic.AtomicInteger;

import static java.lang.Math.max;
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB_TYPE_ROCKSDB;
import static org.apache.hadoop.ozone.OzoneConsts.DB_BLOCK_COUNT_KEY;
import static org.apache.hadoop.ozone.OzoneConsts.CHUNKS_PATH;
import static org.apache.hadoop.ozone.OzoneConsts.DB_CONTAINER_BYTES_USED_KEY;
Expand All @@ -65,7 +66,7 @@ public class KeyValueContainerData extends ContainerData {
private String metadataPath;

//Type of DB used to store key to chunks mapping
private String containerDBType;
private String containerDBType = CONTAINER_DB_TYPE_ROCKSDB;

private File dbFile = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@

import com.google.common.primitives.Longs;
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_DATANODE_DIR_KEY;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_LEVELDB;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_ROCKSDB;
import static org.apache.hadoop.ozone.container.common.impl.ChunkLayOutVersion.FILE_PER_BLOCK;
import static org.apache.hadoop.ozone.container.common.impl.ChunkLayOutVersion.FILE_PER_CHUNK;
import org.junit.After;
Expand All @@ -71,30 +68,25 @@ public class TestKeyValueBlockIterator {
private OzoneConfiguration conf;
private File testRoot;

private final String storeImpl;
private final ChunkLayOutVersion layout;

public TestKeyValueBlockIterator(String metadataImpl,
ChunkLayOutVersion layout) {
this.storeImpl = metadataImpl;
public TestKeyValueBlockIterator(ChunkLayOutVersion layout) {
this.layout = layout;
}

@Parameterized.Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{OZONE_METADATA_STORE_IMPL_LEVELDB, FILE_PER_CHUNK},
{OZONE_METADATA_STORE_IMPL_ROCKSDB, FILE_PER_CHUNK},
{OZONE_METADATA_STORE_IMPL_LEVELDB, FILE_PER_BLOCK},
{OZONE_METADATA_STORE_IMPL_ROCKSDB, FILE_PER_BLOCK}});
{FILE_PER_CHUNK},
{FILE_PER_BLOCK}
});
}

@Before
public void setUp() throws Exception {
testRoot = GenericTestUtils.getRandomizedTestDir();
conf = new OzoneConfiguration();
conf.set(HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
conf.set(OZONE_METADATA_STORE_IMPL, storeImpl);
volumeSet = new MutableVolumeSet(UUID.randomUUID().toString(), conf);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@
import java.util.UUID;

import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_DATANODE_DIR_KEY;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL;

import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_LEVELDB;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_ROCKSDB;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
Expand All @@ -76,7 +72,6 @@
private static final Logger LOG =
LoggerFactory.getLogger(TestKeyValueContainerCheck.class);

private final String storeImpl;
private final ChunkLayoutTestInfo chunkManagerTestInfo;
private KeyValueContainer container;
private KeyValueContainerData containerData;
Expand All @@ -85,28 +80,22 @@
private File testRoot;
private ChunkManager chunkManager;

public TestKeyValueContainerCheck(String metadataImpl,
ChunkLayoutTestInfo chunkManagerTestInfo) {
this.storeImpl = metadataImpl;
public TestKeyValueContainerCheck(ChunkLayoutTestInfo chunkManagerTestInfo) {
this.chunkManagerTestInfo = chunkManagerTestInfo;
}

@Parameterized.Parameters public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{OZONE_METADATA_STORE_IMPL_LEVELDB, ChunkLayoutTestInfo.FILE_PER_CHUNK},
{OZONE_METADATA_STORE_IMPL_LEVELDB, ChunkLayoutTestInfo.FILE_PER_BLOCK},
{OZONE_METADATA_STORE_IMPL_ROCKSDB, ChunkLayoutTestInfo.FILE_PER_CHUNK},
{OZONE_METADATA_STORE_IMPL_ROCKSDB, ChunkLayoutTestInfo.FILE_PER_BLOCK}
{ChunkLayoutTestInfo.FILE_PER_CHUNK},
{ChunkLayoutTestInfo.FILE_PER_BLOCK}
});
}

@Before public void setUp() throws Exception {
LOG.info("Testing store:{} layout:{}",
storeImpl, chunkManagerTestInfo.getLayout());
LOG.info("Testing layout:{}", chunkManagerTestInfo.getLayout());
this.testRoot = GenericTestUtils.getRandomizedTestDir();
conf = new OzoneConfiguration();
conf.set(HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
conf.set(OZONE_METADATA_STORE_IMPL, storeImpl);
chunkManagerTestInfo.updateConfig(conf);
volumeSet = new MutableVolumeSet(UUID.randomUUID().toString(), conf);
chunkManager = chunkManagerTestInfo.createChunkManager(true, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
/**
* LevelDB interface.
*/
@Deprecated
public class LevelDBStore implements MetadataStore {

private static final Logger LOG =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/**
* LevelDB store iterator.
*/
@Deprecated
public class LevelDBStoreIterator
implements MetaStoreIterator<MetadataStore.KeyValue> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@

import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.OzoneConfigKeys;

import com.google.common.annotations.VisibleForTesting;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_LEVELDB;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_ROCKSDB;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_ROCKSDB_STATISTICS;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_ROCKSDB_STATISTICS_DEFAULT;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_METADATA_STORE_ROCKSDB_STATISTICS_OFF;
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB_TYPE_LEVELDB;
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB_TYPE_ROCKSDB;

import org.iq80.leveldb.Options;
import org.rocksdb.BlockBasedTableConfig;
import org.rocksdb.Statistics;
Expand Down Expand Up @@ -104,22 +104,19 @@ public MetadataStore build() throws IOException {
final ConfigurationSource conf = optionalConf.orElse(DEFAULT_CONF);

if (dbType == null) {
LOG.debug("dbType is null, using ");
dbType = conf.getTrimmed(OzoneConfigKeys.OZONE_METADATA_STORE_IMPL,
OzoneConfigKeys.OZONE_METADATA_STORE_IMPL_DEFAULT);
LOG.debug("dbType is null, using dbType {} from ozone configuration",
dbType);
dbType = CONTAINER_DB_TYPE_ROCKSDB;
LOG.debug("dbType is null, using dbType {}.", dbType);
} else {
LOG.debug("Using dbType {} for metastore", dbType);
}
if (OZONE_METADATA_STORE_IMPL_LEVELDB.equals(dbType)) {
if (CONTAINER_DB_TYPE_LEVELDB.equals(dbType)) {
Options options = new Options();
options.createIfMissing(createIfMissing);
if (cacheSize > 0) {
options.cacheSize(cacheSize);
}
return new LevelDBStore(dbFile, options);
} else if (OZONE_METADATA_STORE_IMPL_ROCKSDB.equals(dbType)) {
} else if (CONTAINER_DB_TYPE_ROCKSDB.equals(dbType)) {
org.rocksdb.Options opts;
// Used cached options if config object passed down is the same
if (CACHED_OPTS.containsKey(conf)) {
Expand Down Expand Up @@ -147,10 +144,8 @@ public MetadataStore build() throws IOException {
return new RocksDBStore(dbFile, opts);
}

throw new IllegalArgumentException("Invalid argument for "
+ OzoneConfigKeys.OZONE_METADATA_STORE_IMPL
+ ". Expecting " + OZONE_METADATA_STORE_IMPL_LEVELDB
+ " or " + OZONE_METADATA_STORE_IMPL_ROCKSDB
+ ", but met " + dbType);
throw new IllegalArgumentException("Invalid Container DB type. Expecting "
+ CONTAINER_DB_TYPE_LEVELDB + " or "
+ CONTAINER_DB_TYPE_ROCKSDB + ", but met " + dbType);
}
}
Loading