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 @@ -39,6 +39,13 @@ public final class HddsPolicyProvider extends PolicyProvider {
private static final Supplier<HddsPolicyProvider> SUPPLIER =
MemoizedSupplier.valueOf(HddsPolicyProvider::new);

private static final List<Service> DN_SERVICES =
Collections.singletonList(
new Service(
OZONE_SECURITY_RECONFIGURE_PROTOCOL_ACL,
ReconfigureProtocol.class)
);

private HddsPolicyProvider() {
}

Expand All @@ -48,12 +55,6 @@ public static HddsPolicyProvider getInstance() {
return SUPPLIER.get();
}

private static final List<Service> DN_SERVICES =
Collections.singletonList(
new Service(
OZONE_SECURITY_RECONFIGURE_PROTOCOL_ACL,
ReconfigureProtocol.class)
);

@Override
public Service[] getServices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,11 @@
*/
@InterfaceAudience.Private
public final class CommandHandlerMetrics implements MetricsSource {
enum CommandMetricsMetricsInfo implements MetricsInfo {
Command("The type of the SCM command"),
TotalRunTimeMs("The total runtime of the command handler in milliseconds"),
AvgRunTimeMs("Average run time of the command handler in milliseconds"),
QueueWaitingTaskCount("The number of queued tasks waiting for execution"),
InvocationCount("The number of times the command handler has been invoked"),
ThreadPoolActivePoolSize("The number of active threads in the thread pool"),
ThreadPoolMaxPoolSize("The maximum number of threads in the thread pool"),
CommandReceivedCount(
"The number of received SCM commands for each command type");

private final String desc;
CommandMetricsMetricsInfo(String desc) {
this.desc = desc;
}
public static final String SOURCE_NAME = CommandHandlerMetrics.class.getSimpleName();

@Override
public String description() {
return desc;
}
}

public static final String SOURCE_NAME =
CommandHandlerMetrics.class.getSimpleName();
private final Map<Type, CommandHandler> handlerMap;
private final Map<Type, AtomicInteger> commandCount;

private CommandHandlerMetrics(Map<Type, CommandHandler> handlerMap) {
this.handlerMap = handlerMap;
this.commandCount = new HashMap<>();
Expand Down Expand Up @@ -121,4 +100,26 @@ public void unRegister() {
MetricsSystem ms = DefaultMetricsSystem.instance();
ms.unregisterSource(SOURCE_NAME);
}

enum CommandMetricsMetricsInfo implements MetricsInfo {
Command("The type of the SCM command"),
TotalRunTimeMs("The total runtime of the command handler in milliseconds"),
AvgRunTimeMs("Average run time of the command handler in milliseconds"),
QueueWaitingTaskCount("The number of queued tasks waiting for execution"),
InvocationCount("The number of times the command handler has been invoked"),
ThreadPoolActivePoolSize("The number of active threads in the thread pool"),
ThreadPoolMaxPoolSize("The maximum number of threads in the thread pool"),
CommandReceivedCount(
"The number of received SCM commands for each command type");

private final String desc;
CommandMetricsMetricsInfo(String desc) {
this.desc = desc;
}

@Override
public String description() {
return desc;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
* marking the container as closed.
*/
public class OpenContainerBlockMap {
/**
* TODO : We may construct the openBlockMap by reading the Block Layout
* for each block inside a container listing all chunk files and reading the
* sizes. This will help to recreate the openKeys Map once the DataNode
* restarts.
*
* For now, we will track all open blocks of a container in the blockMap.
*/
private final ConcurrentMap<Long, BlockDataMap> containers = new ConcurrentHashMap<>();

/**
* Map: localId {@literal ->} BlockData.
*
Expand Down Expand Up @@ -69,17 +79,6 @@ synchronized List<BlockData> getAll() {
}
}

/**
* TODO : We may construct the openBlockMap by reading the Block Layout
* for each block inside a container listing all chunk files and reading the
* sizes. This will help to recreate the openKeys Map once the DataNode
* restarts.
*
* For now, we will track all open blocks of a container in the blockMap.
*/
private final ConcurrentMap<Long, BlockDataMap> containers =
new ConcurrentHashMap<>();

/**
* Removes the Container matching with specified containerId.
* @param containerId containerId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ public interface Container<CONTAINERDATA extends ContainerData> {
* Encapsulates the result of a container scan.
*/
class ScanResult {
/**
* Represents the reason a container scan failed and a container should
* be marked unhealthy.
*/
public enum FailureType {
MISSING_CONTAINER_DIR,
MISSING_METADATA_DIR,
MISSING_CONTAINER_FILE,
MISSING_CHUNKS_DIR,
MISSING_CHUNK_FILE,
CORRUPT_CONTAINER_FILE,
CORRUPT_CHUNK,
INCONSISTENT_CHUNK_LENGTH,
INACCESSIBLE_DB,
WRITE_FAILURE,
DELETED_CONTAINER
}

private final boolean healthy;
private final File unhealthyFile;
private final FailureType failureType;
Expand Down Expand Up @@ -94,6 +76,24 @@ public FailureType getFailureType() {
public Throwable getException() {
return exception;
}

/**
* Represents the reason a container scan failed and a container should
* be marked unhealthy.
*/
public enum FailureType {
MISSING_CONTAINER_DIR,
MISSING_METADATA_DIR,
MISSING_CONTAINER_FILE,
MISSING_CHUNKS_DIR,
MISSING_CHUNK_FILE,
CORRUPT_CONTAINER_FILE,
CORRUPT_CHUNK,
INCONSISTENT_CHUNK_LENGTH,
INACCESSIBLE_DB,
WRITE_FAILURE,
DELETED_CONTAINER
}
}

/**
Expand Down
Loading