-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDDS-1550. MiniOzoneCluster is not shutting down all the threads during shutdown. Contributed by Mukul Kumar Singh. #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,6 +57,7 @@ | |
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| /** | ||
| * Creates a Grpc server endpoint that acts as the communication layer for | ||
|
|
@@ -172,6 +173,11 @@ public void start() throws IOException { | |
| public void stop() { | ||
| if (isStarted) { | ||
| server.shutdown(); | ||
| try { | ||
| server.awaitTermination(1, TimeUnit.DAYS); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's better to read the value from configuration file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above. |
||
| } catch (Exception e) { | ||
| LOG.error("failed to shutdown XceiverServerGrpc", e); | ||
| } | ||
| isStarted = false; | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,7 @@ | |
| import org.apache.hadoop.hdfs.DFSUtil; | ||
| import org.apache.hadoop.io.IOUtils; | ||
| import org.apache.hadoop.ipc.RPC; | ||
| import org.apache.hadoop.metrics2.MetricsSystem; | ||
| import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; | ||
| import org.apache.hadoop.metrics2.util.MBeans; | ||
| import org.apache.hadoop.ozone.OzoneConfigKeys; | ||
|
|
@@ -205,6 +206,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl | |
| private final OzoneConfiguration configuration; | ||
| private final SafeModeHandler safeModeHandler; | ||
| private SCMContainerMetrics scmContainerMetrics; | ||
| private MetricsSystem ms; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest modify the instance variable name, so that it readability. |
||
|
|
||
| /** | ||
| * Creates a new StorageContainerManager. Configuration will be | ||
|
|
@@ -898,7 +900,7 @@ public void start() throws IOException { | |
| buildRpcServerStartMessage( | ||
| "StorageContainerLocationProtocol RPC server", | ||
| getClientRpcAddress())); | ||
| DefaultMetricsSystem.initialize("StorageContainerManager"); | ||
| ms = DefaultMetricsSystem.initialize("StorageContainerManager"); | ||
|
|
||
| commandWatcherLeaseManager.start(); | ||
| getClientProtocolServer().start(); | ||
|
|
@@ -993,6 +995,10 @@ public void stop() { | |
| metrics.unRegister(); | ||
| } | ||
|
|
||
| if (ms != null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in order of precedence, i think closing scmMetadataStore takes more precedence than Metrics. Shall we move this close statement to end. |
||
| ms.stop(); | ||
| } | ||
|
|
||
| unregisterMXBean(); | ||
| if (scmContainerMetrics != null) { | ||
| scmContainerMetrics.unRegister(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,7 +203,7 @@ void initializeConfiguration() throws IOException { | |
| 1, TimeUnit.SECONDS); | ||
| conf.setTimeDuration(HddsConfigKeys.HDDS_HEARTBEAT_INTERVAL, 1, | ||
| TimeUnit.SECONDS); | ||
| conf.setInt(OzoneConfigKeys.OZONE_CONTAINER_CACHE_SIZE, 8); | ||
| conf.setInt(OzoneConfigKeys.OZONE_CONTAINER_CACHE_SIZE, 2); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the purpose of change the cache size? |
||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -340,19 +340,20 @@ public void stop() { | |
| ozoneManager.join(); | ||
| } | ||
|
|
||
| if (!hddsDatanodes.isEmpty()) { | ||
| LOG.info("Shutting the HddsDatanodes"); | ||
| hddsDatanodes.parallelStream() | ||
| .forEach(dn -> { | ||
| dn.stop(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we wrap them in try catch to cleanup all of them silently. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review Ajay, I didnot understand this comment completely. Can you please elaborate. ? |
||
| dn.join(); | ||
| }); | ||
| } | ||
|
|
||
| if (scm != null) { | ||
| LOG.info("Stopping the StorageContainerManager"); | ||
| scm.stop(); | ||
| scm.join(); | ||
| } | ||
|
|
||
| if (!hddsDatanodes.isEmpty()) { | ||
| LOG.info("Shutting the HddsDatanodes"); | ||
| for (HddsDatanodeService hddsDatanode : hddsDatanodes) { | ||
| hddsDatanode.stop(); | ||
| hddsDatanode.join(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -568,6 +569,8 @@ private void configureSCM() { | |
| conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_ADDRESS_KEY, "127.0.0.1:0"); | ||
| conf.set(ScmConfigKeys.OZONE_SCM_HTTP_ADDRESS_KEY, "127.0.0.1:0"); | ||
| conf.setInt(ScmConfigKeys.OZONE_SCM_HANDLER_COUNT_KEY, numOfScmHandlers); | ||
| conf.set(HddsConfigKeys.HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT, | ||
| "3s"); | ||
| configureSCMheartbeat(); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first letter of the first word as a capital letter maybe better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want timeUnit to be Days?