-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-4622: Use singe server raft cluster in MiniOzoneCluster. #1738
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 |
|---|---|---|
|
|
@@ -76,7 +76,8 @@ public static void setRaftStorageDir(final RaftProperties properties, | |
| final ConfigurationSource conf) { | ||
| String storageDir = haConf.getRatisStorageDir(); | ||
| if (Strings.isNullOrEmpty(storageDir)) { | ||
| storageDir = ServerUtils.getDefaultRatisDirectory(conf); | ||
| File metaDirPath = ServerUtils.getOzoneMetaDirPath(conf); | ||
| storageDir = (new File(metaDirPath, "scm-ha")).getPath(); | ||
| } | ||
| RaftServerConfigKeys.setStorageDir(properties, | ||
| Collections.singletonList(new File(storageDir))); | ||
|
|
@@ -100,9 +101,9 @@ private static void setRaftRpcProperties(final RaftProperties properties, | |
| Rpc.setRequestTimeout(properties, TimeDuration.valueOf( | ||
| conf.getRatisRequestTimeout(), TimeUnit.MILLISECONDS)); | ||
| Rpc.setTimeoutMin(properties, TimeDuration.valueOf( | ||
| conf.getRatisRequestMinTimeout(), TimeUnit.MILLISECONDS)); | ||
|
||
| conf.getLeaderElectionMinTimeout(), TimeUnit.MILLISECONDS)); | ||
| Rpc.setTimeoutMax(properties, TimeDuration.valueOf( | ||
| conf.getRatisRequestMaxTimeout(), TimeUnit.MILLISECONDS)); | ||
| conf.getLeaderElectionMaxTimeout(), TimeUnit.MILLISECONDS)); | ||
| Rpc.setSlownessTimeout(properties, TimeDuration.valueOf( | ||
| conf.getRatisNodeFailureTimeout(), TimeUnit.MILLISECONDS)); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,126 +181,73 @@ public Pipeline createPipeline(ReplicationType type, ReplicationFactor factor, | |
| @Override | ||
| public Pipeline getPipeline(PipelineID pipelineID) | ||
| throws PipelineNotFoundException { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getPipeline(pipelineID); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getPipeline(pipelineID); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean containsPipeline(PipelineID pipelineID) { | ||
| lock.readLock().lock(); | ||
| try { | ||
| getPipeline(pipelineID); | ||
| return true; | ||
| } catch (PipelineNotFoundException e) { | ||
| return false; | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public List<Pipeline> getPipelines() { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getPipelines(); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getPipelines(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Pipeline> getPipelines(ReplicationType type) { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getPipelines(type); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getPipelines(type); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Pipeline> getPipelines(ReplicationType type, | ||
| ReplicationFactor factor) { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getPipelines(type, factor); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getPipelines(type, factor); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Pipeline> getPipelines(ReplicationType type, | ||
| Pipeline.PipelineState state) { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getPipelines(type, state); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getPipelines(type, state); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Pipeline> getPipelines(ReplicationType type, | ||
| ReplicationFactor factor, | ||
| Pipeline.PipelineState state) { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getPipelines(type, factor, state); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getPipelines(type, factor, state); | ||
| } | ||
|
|
||
| @Override | ||
| public List<Pipeline> getPipelines( | ||
| ReplicationType type, ReplicationFactor factor, | ||
| Pipeline.PipelineState state, Collection<DatanodeDetails> excludeDns, | ||
| Collection<PipelineID> excludePipelines) { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager | ||
| return stateManager | ||
|
Contributor
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. so the dead lock solution seems is removing the read write lock? Is there an explanation why we can remove locks here?
Contributor
Author
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. I will create a jira for this issue, can give the explanation of this solution there. |
||
| .getPipelines(type, factor, state, excludeDns, excludePipelines); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void addContainerToPipeline( | ||
| PipelineID pipelineID, ContainerID containerID) throws IOException { | ||
| lock.writeLock().lock(); | ||
| try { | ||
| stateManager.addContainerToPipeline(pipelineID, containerID); | ||
| } finally { | ||
| lock.writeLock().unlock(); | ||
| } | ||
| stateManager.addContainerToPipeline(pipelineID, containerID); | ||
| } | ||
|
|
||
| @Override | ||
| public void removeContainerFromPipeline( | ||
| PipelineID pipelineID, ContainerID containerID) throws IOException { | ||
| lock.writeLock().lock(); | ||
| try { | ||
| stateManager.removeContainerFromPipeline(pipelineID, containerID); | ||
| } finally { | ||
| lock.writeLock().unlock(); | ||
| } | ||
| stateManager.removeContainerFromPipeline(pipelineID, containerID); | ||
| } | ||
|
|
||
| @Override | ||
| public NavigableSet<ContainerID> getContainersInPipeline( | ||
| PipelineID pipelineID) throws IOException { | ||
| lock.readLock().lock(); | ||
| try { | ||
| return stateManager.getContainers(pipelineID); | ||
| } finally { | ||
| lock.readLock().unlock(); | ||
| } | ||
| return stateManager.getContainers(pipelineID); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -475,7 +475,6 @@ public static void quasiCloseContainer(ContainerManagerV2 containerManager, | |
| public static StorageContainerManager getScmSimple(OzoneConfiguration conf) | ||
| throws IOException, AuthenticationException { | ||
| SCMConfigurator configurator = new SCMConfigurator(); | ||
| configurator.setSCMHAManager(MockSCMHAManager.getInstance(true)); | ||
|
Contributor
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. You will need this line:
Contributor
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. So currently the I am guessing CI can still pass become you also have changed the rpc timeout parameters. So either the cluster wait for ready or the parameter change can solve the I am not sure if we need both. Maybe we only need to keep
Contributor
Author
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. Good catch! |
||
| return StorageContainerManager.createSCM(conf, configurator); | ||
| } | ||
|
|
||
|
|
||
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.
I think it's prefered to use SCMHA Configuration to set the storageDir
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.
agree
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.
After #1739 this can be set through HA config.