HDFS-12908. Ozone: write chunk call fails because of Metrics registry exception. Contributed by Mukul Kumar Singh.
This commit is contained in:
parent
4b9f66a19e
commit
ce19f09bd0
@ -76,7 +76,9 @@ public final class OzoneConsts {
|
|||||||
/**
|
/**
|
||||||
* level DB names used by SCM and data nodes.
|
* level DB names used by SCM and data nodes.
|
||||||
*/
|
*/
|
||||||
public static final String CONTAINER_DB = "container.db";
|
public static final String CONTAINER_DB_SUFFIX = "container.db";
|
||||||
|
public static final String SCM_CONTAINER_DB = "scm-" + CONTAINER_DB_SUFFIX;
|
||||||
|
public static final String DN_CONTAINER_DB = "-dn-"+ CONTAINER_DB_SUFFIX;
|
||||||
public static final String BLOCK_DB = "block.db";
|
public static final String BLOCK_DB = "block.db";
|
||||||
public static final String NODEPOOL_DB = "nodepool.db";
|
public static final String NODEPOOL_DB = "nodepool.db";
|
||||||
public static final String OPEN_CONTAINERS_DB = "openContainers.db";
|
public static final String OPEN_CONTAINERS_DB = "openContainers.db";
|
||||||
|
@ -230,13 +230,18 @@ public static void verifyIsNewContainer(File containerFile, File metadataFile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getContainerDbFileName(String containerName) {
|
||||||
|
return containerName + OzoneConsts.DN_CONTAINER_DB;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a Metadata DB for the specified container.
|
* creates a Metadata DB for the specified container.
|
||||||
*
|
*
|
||||||
* @param containerPath - Container Path.
|
* @param containerPath - Container Path.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static Path createMetadata(Path containerPath, Configuration conf)
|
public static Path createMetadata(Path containerPath, String containerName,
|
||||||
|
Configuration conf)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Logger log = LoggerFactory.getLogger(ContainerManagerImpl.class);
|
Logger log = LoggerFactory.getLogger(ContainerManagerImpl.class);
|
||||||
Preconditions.checkNotNull(containerPath);
|
Preconditions.checkNotNull(containerPath);
|
||||||
@ -250,7 +255,8 @@ public static Path createMetadata(Path containerPath, Configuration conf)
|
|||||||
MetadataStore store = MetadataStoreBuilder.newBuilder()
|
MetadataStore store = MetadataStoreBuilder.newBuilder()
|
||||||
.setConf(conf)
|
.setConf(conf)
|
||||||
.setCreateIfMissing(true)
|
.setCreateIfMissing(true)
|
||||||
.setDbFile(metadataPath.resolve(OzoneConsts.CONTAINER_DB).toFile())
|
.setDbFile(metadataPath
|
||||||
|
.resolve(getContainerDbFileName(containerName)).toFile())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// we close since the SCM pre-creates containers.
|
// we close since the SCM pre-creates containers.
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.BLOCK_DB;
|
import static org.apache.hadoop.ozone.OzoneConsts.BLOCK_DB;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB;
|
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB_SUFFIX;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.KSM_DB_NAME;
|
import static org.apache.hadoop.ozone.OzoneConsts.KSM_DB_NAME;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.KSM_USER_PREFIX;
|
import static org.apache.hadoop.ozone.OzoneConsts.KSM_USER_PREFIX;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.KSM_BUCKET_PREFIX;
|
import static org.apache.hadoop.ozone.OzoneConsts.KSM_BUCKET_PREFIX;
|
||||||
@ -293,7 +293,7 @@ public int run(String[] args) throws Exception {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.info("Parent path [{}] db name [{}]", parentPath, dbName);
|
LOG.info("Parent path [{}] db name [{}]", parentPath, dbName);
|
||||||
if (dbName.toString().equals(CONTAINER_DB)) {
|
if (dbName.toString().endsWith(CONTAINER_DB_SUFFIX)) {
|
||||||
LOG.info("Converting container DB");
|
LOG.info("Converting container DB");
|
||||||
convertContainerDB(dbPath, outPath);
|
convertContainerDB(dbPath, outPath);
|
||||||
} else if (dbName.toString().equals(BLOCK_DB)) {
|
} else if (dbName.toString().equals(BLOCK_DB)) {
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB;
|
import static org.apache.hadoop.ozone.OzoneConsts.SCM_CONTAINER_DB;
|
||||||
import static org.apache.hadoop.ozone.scm.exceptions.SCMException.ResultCodes.FAILED_TO_CHANGE_CONTAINER_STATE;
|
import static org.apache.hadoop.ozone.scm.exceptions.SCMException.ResultCodes.FAILED_TO_CHANGE_CONTAINER_STATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,7 +102,7 @@ public ContainerMapping(
|
|||||||
File metaDir = OzoneUtils.getOzoneMetaDirPath(conf);
|
File metaDir = OzoneUtils.getOzoneMetaDirPath(conf);
|
||||||
|
|
||||||
// Write the container name to pipeline mapping.
|
// Write the container name to pipeline mapping.
|
||||||
File containerDBPath = new File(metaDir, CONTAINER_DB);
|
File containerDBPath = new File(metaDir, SCM_CONTAINER_DB);
|
||||||
containerStore =
|
containerStore =
|
||||||
MetadataStoreBuilder.newBuilder()
|
MetadataStoreBuilder.newBuilder()
|
||||||
.setConf(conf)
|
.setConf(conf)
|
||||||
|
@ -23,11 +23,8 @@
|
|||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.hadoop.metrics2.util.MBeans;
|
import org.apache.hadoop.metrics2.util.MBeans;
|
||||||
import org.apache.ratis.shaded.com.google.common.annotations.VisibleForTesting;
|
import org.apache.ratis.shaded.com.google.common.annotations.VisibleForTesting;
|
||||||
import org.rocksdb.DBOptions;
|
|
||||||
import org.rocksdb.RocksIterator;
|
import org.rocksdb.RocksIterator;
|
||||||
import org.rocksdb.Options;
|
import org.rocksdb.Options;
|
||||||
import org.rocksdb.Statistics;
|
|
||||||
import org.rocksdb.StatsLevel;
|
|
||||||
import org.rocksdb.WriteOptions;
|
import org.rocksdb.WriteOptions;
|
||||||
import org.rocksdb.RocksDB;
|
import org.rocksdb.RocksDB;
|
||||||
import org.rocksdb.RocksDBException;
|
import org.rocksdb.RocksDBException;
|
||||||
@ -76,6 +73,10 @@ public RocksDBStore(File dbFile, Options options)
|
|||||||
jmxProperties.put("dbName", dbFile.getName());
|
jmxProperties.put("dbName", dbFile.getName());
|
||||||
statMBeanName = MBeans.register("Ozone", "RocksDbStore", jmxProperties,
|
statMBeanName = MBeans.register("Ozone", "RocksDbStore", jmxProperties,
|
||||||
new RocksDBStoreMBean(dbOptions.statistics()));
|
new RocksDBStoreMBean(dbOptions.statistics()));
|
||||||
|
if (statMBeanName == null) {
|
||||||
|
LOG.warn("jmx registration failed during RocksDB init, db path :{}",
|
||||||
|
dbFile.getAbsolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (RocksDBException e) {
|
} catch (RocksDBException e) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
|
@ -164,7 +164,7 @@ public void cleanupDir() throws IOException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean up SCM metadata
|
// Clean up SCM metadata
|
||||||
log.info("Deletting {}", path);
|
log.info("Deleting {}", path);
|
||||||
FileUtils.deleteDirectory(new File(path));
|
FileUtils.deleteDirectory(new File(path));
|
||||||
|
|
||||||
// Clean up SCM datanode container metadata/data
|
// Clean up SCM datanode container metadata/data
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.BLOCK_DB;
|
import static org.apache.hadoop.ozone.OzoneConsts.BLOCK_DB;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.CONTAINER_DB;
|
import static org.apache.hadoop.ozone.OzoneConsts.SCM_CONTAINER_DB;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.KB;
|
import static org.apache.hadoop.ozone.OzoneConsts.KB;
|
||||||
import static org.apache.hadoop.ozone.OzoneConsts.NODEPOOL_DB;
|
import static org.apache.hadoop.ozone.OzoneConsts.NODEPOOL_DB;
|
||||||
//import static org.apache.hadoop.ozone.OzoneConsts.OPEN_CONTAINERS_DB;
|
//import static org.apache.hadoop.ozone.OzoneConsts.OPEN_CONTAINERS_DB;
|
||||||
@ -234,7 +234,7 @@ public void testConvertContainerDB() throws Exception {
|
|||||||
// TODO : the following will fail due to empty Datanode list, need to fix.
|
// TODO : the following will fail due to empty Datanode list, need to fix.
|
||||||
//String dnUUID = cluster.getDataNodes().get(0).getDatanodeUuid();
|
//String dnUUID = cluster.getDataNodes().get(0).getDatanodeUuid();
|
||||||
String dbRootPath = conf.get(OzoneConfigKeys.OZONE_METADATA_DIRS);
|
String dbRootPath = conf.get(OzoneConfigKeys.OZONE_METADATA_DIRS);
|
||||||
String dbPath = dbRootPath + "/" + CONTAINER_DB;
|
String dbPath = dbRootPath + "/" + SCM_CONTAINER_DB;
|
||||||
String[] args = {"-p", dbPath, "-o", dbOutPath};
|
String[] args = {"-p", dbPath, "-o", dbOutPath};
|
||||||
Connection conn;
|
Connection conn;
|
||||||
String sql;
|
String sql;
|
||||||
|
Loading…
Reference in New Issue
Block a user