Class KeyValueContainerMetadataInspector
java.lang.Object
org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerMetadataInspector
- All Implemented Interfaces:
ContainerInspector
Container inspector for key value container metadata. It is capable of
logging metadata information about a container, and repairing the metadata
database values of #BLOCKCOUNT and #BYTESUSED.
To enable this inspector in inspect mode, pass the java system property
-Dozone.datanode.container.metadata.inspector=inspect on datanode startup.
This will cause the inspector to log metadata information about all
containers on datanode startup whose aggregate values of #BLOCKCOUNT and
#BYTESUSED do not match the sum of their parts in the database at the
ERROR level, and information about correct containers at the TRACE level.
Changing the `inspect` argument to `repair` will update these aggregate
values to match the database.
When run, the inspector will output json to the logger named in the
REPORT_LOG variable. The log4j
configuration can be modified to send this output to a separate file
without log information prefixes interfering with the json. For example:
log4j.logger.ContainerMetadataInspectorReport=INFO,inspectorAppender
log4j.appender.inspectorAppender=org.apache.log4j.FileAppender
log4j.appender.inspectorAppender.File=${hadoop.log.dir}/\
containerMetadataInspector.log
log4j.appender.inspectorAppender.layout=org.apache.log4j.PatternLayout-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe mode to run the inspector in. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whether the inspector will be modifying containers as part of the process method.booleanload()Validate configuration here so that an invalid config value is only logged once, and not once per container.voidprocess(ContainerData containerData, DatanodeStore store) Operates on the container as the inspector is configured.process(ContainerData containerData, DatanodeStore store, org.slf4j.Logger log) voidunload()Removes configurations to run the inspector, so that the process method becomes a no-op.
-
Field Details
-
REPORT_LOG
public static final org.slf4j.Logger REPORT_LOG -
SYSTEM_PROPERTY
- See Also:
-
-
Constructor Details
-
KeyValueContainerMetadataInspector
-
KeyValueContainerMetadataInspector
public KeyValueContainerMetadataInspector()
-
-
Method Details
-
load
public boolean load()Validate configuration here so that an invalid config value is only logged once, and not once per container.- Specified by:
loadin interfaceContainerInspector- Returns:
- true if the inspector will operate when process is called. False otherwise.
-
unload
public void unload()Description copied from interface:ContainerInspectorRemoves configurations to run the inspector, so that the process method becomes a no-op.- Specified by:
unloadin interfaceContainerInspector
-
isReadOnly
public boolean isReadOnly()Description copied from interface:ContainerInspectorDetermines whether the inspector will be modifying containers as part of the process method.- Specified by:
isReadOnlyin interfaceContainerInspector- Returns:
- true if the inspector will only read the container, false if it will be making modifications/repairs.
-
process
Description copied from interface:ContainerInspectorOperates on the container as the inspector is configured. This may involve logging information or fixing errors. Multiple containers may be processed in parallel by calling this method on the same inspector instance, but only one process call will be invoked per container at a time. Implementations must ensure that: 1. Information they log is batched so that log output from other inspectors working on other containers is not interleaved. 2. Multiple process calls to the same inspector instance with different containers are thread safe.- Specified by:
processin interfaceContainerInspector- Parameters:
containerData- Container data for the container to process.store- The metadata store for this container.
-
process
-