Skip to content

Conversation

@adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

If failures happen during volume initialization, the volume object is abandoned, and a failed volume created instead. The original object should be cleaned up.

  1. StorageVolume#initialize may throw IOException. By this time it may have started background thread for disk usage check. HddsVolume also created and registered metrics objects.
  2. MutableVolumeSet#initializeVolumeSet also may throw IOException if storage directory does not exist and cannot be created.

To reproduce, simply add /root as an additional data or DB directory (assuming non-root user runs datanode):

OZONE-SITE.XML_hdds.datanode.dir=/root,/data/hdds
OZONE-SITE.XML_hdds.datanode.container.db.dir=/root,/data/metadata/db

Failed data volume results in datanode stopping during startup:

datanode_1  | [main] INFO volume.HddsVolume: Creating HddsVolume: /root/hdds of storage type : DISK capacity : 499596230656
datanode_1  | [main] ERROR ozone.HddsDatanodeService: Exception in HddsDatanodeService.
datanode_1  | org.apache.hadoop.metrics2.MetricsException: Metrics source VolumeInfoMetrics-/root already exists!
datanode_1  | 	at org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.newSourceName(DefaultMetricsSystem.java:152)
datanode_1  | 	at org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.sourceName(DefaultMetricsSystem.java:125)
datanode_1  | 	at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.register(MetricsSystemImpl.java:229)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.VolumeInfoMetrics.init(VolumeInfoMetrics.java:50)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.VolumeInfoMetrics.<init>(VolumeInfoMetrics.java:45)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.HddsVolume.<init>(HddsVolume.java:140)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.HddsVolume.<init>(HddsVolume.java:73)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.HddsVolume$Builder.build(HddsVolume.java:115)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.HddsVolumeFactory.createFailedVolume(HddsVolumeFactory.java:60)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet.initializeVolumeSet(MutableVolumeSet.java:187)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet.<init>(MutableVolumeSet.java:135)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.volume.MutableVolumeSet.<init>(MutableVolumeSet.java:99)
datanode_1  | 	at org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer.<init>(OzoneContainer.java:146)
datanode_1  | 	at org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine.<init>(DatanodeStateMachine.java:173)
datanode_1  | 	at org.apache.hadoop.ozone.HddsDatanodeService.start(HddsDatanodeService.java:306)

Failed DB volume only results in leftover thread for the abandoned volume (/root here):

$ jstack $(jps | grep Datanode | awk '{ print $1 }') | grep DiskUsage
"DiskUsage-/data/hdds-
"DiskUsage-/data/metadata/ratis-
"DiskUsage-/root-
"DiskUsage-/data/metadata/db-

https://issues.apache.org/jira/browse/HDDS-8914

How was this patch tested?

Verified that datanode starts successfully with additional read-only volume, and that DiskUsage thread for the abandoned volume is not running.

$ jstack $(jps | grep Datanode | awk '{ print $1 }') | grep DiskUsage
"DiskUsage-/data/hdds-
"DiskUsage-/data/metadata/ratis-
"DiskUsage-/data/metadata/db-

@adoroszlai adoroszlai self-assigned this Jun 23, 2023
@adoroszlai adoroszlai added bug Something isn't working datanode labels Jun 23, 2023
@adoroszlai
Copy link
Contributor Author

@ArafatKhan2198 please take a look

@ArafatKhan2198
Copy link
Contributor

Thanks for working on this @adoroszlai it's a good find!
LGTM +1

Copy link
Contributor

@duongkame duongkame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch @adoroszlai .

@adoroszlai adoroszlai merged commit 45eb9d4 into apache:master Jun 26, 2023
@adoroszlai adoroszlai deleted the HDDS-8914 branch June 26, 2023 18:38
@adoroszlai
Copy link
Contributor Author

Thanks @ArafatKhan2198, @duongkame for the review.

errose28 added a commit to errose28/ozone that referenced this pull request Jun 26, 2023
* master: (79 commits)
  HDDS-8914. Datanode may fail to start due to duplicate VolumeInfoMetrics (apache#4966)
  HDDS-8921. Add support for EC in Freon SCM block generator (apache#4982)
  HDDS-8927. Metadata scanner should not scan unhealthy containers. (apache#4976)
  HDDS-8929. Avoid list allocation for pipeline search (apache#4980)
  HDDS-8778. Support recursive volume delete using Ozone sh command. (apache#4842)
  HDDS-8885. Quota repair count enable quota feature for old bucket/volume. (apache#4941)
  HDDS-8771. Refactor volume level tmp directory for generic usage. (apache#4838)
  HDDS-8922. Random EC read pipeline ID causes XceiverClient cache churn (apache#4971)
  HDDS-8586 Recon. - API for Count of deletePending keys and amount of data mapped to such keys. (apache#4923)
  HDDS-8908. Intermittent failure in TestBlockDeletion#testBlockDeletion (apache#4958)
  HDDS-8910. Replace LockManager with striped lock in ContainerStateManager (apache#4962)
  HDDS-8917. Move protobuf conversion out of the lock in PipelineStateManagerImpl (apache#4965)
  HDDS-8825. Use apache/hadoop 3.3.5 docker image (apache#4963)
  HDDS-8906. Avoid stream when getting in-service healthy nodes (apache#4960)
  HDDS-8907. Store volume count when storage report is updated (apache#4957)
  HDDS-8905. PipelineManager metrics should not be synchronized (apache#4959)
  HDDS-8553. Improve scanner integration tests. (apache#4936)
  HDDS-8854. Avoid unnecessary DatanodeDetails creation for NodeStateManager lookup (apache#4925)
  HDDS-8315. [Snapshot] Added unit tests for SnapshotDiffManager (apache#4716)
  HDDS-7968. [Snapshot] Improve KeyDeletingService to reclaim eligible key blocks in snapshot's deletedTable (apache#4935)
  ...
errose28 added a commit to errose28/ozone that referenced this pull request Jun 26, 2023
* master:
  HDDS-8914. Datanode may fail to start due to duplicate VolumeInfoMetrics (apache#4966)
  HDDS-8921. Add support for EC in Freon SCM block generator (apache#4982)
  HDDS-8927. Metadata scanner should not scan unhealthy containers. (apache#4976)
  HDDS-8929. Avoid list allocation for pipeline search (apache#4980)
  HDDS-8778. Support recursive volume delete using Ozone sh command. (apache#4842)
  HDDS-8885. Quota repair count enable quota feature for old bucket/volume. (apache#4941)
  HDDS-8771. Refactor volume level tmp directory for generic usage. (apache#4838)
  HDDS-8922. Random EC read pipeline ID causes XceiverClient cache churn (apache#4971)
vtutrinov pushed a commit to Cyrill/ozone that referenced this pull request Jul 3, 2023
vtutrinov pushed a commit to Cyrill/ozone that referenced this pull request Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working datanode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants