[
https://issues.apache.org/jira/browse/HDDS-1148?focusedWorklogId=202251&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-202251
]
ASF GitHub Bot logged work on HDDS-1148:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Feb/19 21:53
Start Date: 21/Feb/19 21:53
Worklog Time Spent: 10m
Work Description: bharatviswa504 commented on pull request #511:
HDDS-1148. After allocating container, we are not adding to container DB.
URL: https://github.com/apache/hadoop/pull/511#discussion_r259132320
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
##########
@@ -360,16 +355,108 @@ public ContainerInfo getMatchingContainer(final long
sizeRequired,
String owner, Pipeline pipeline) {
try {
//TODO: #CLUTIL See if lock is required here
- return containerStateManager
- .getMatchingContainer(sizeRequired, owner, pipelineManager,
- pipeline);
+ NavigableSet<ContainerID> containerIDs =
+ pipelineManager.getContainersInPipeline(pipeline.getId());
+ if (containerIDs == null) {
+ LOG.error("Container list is null for pipeline=", pipeline.getId());
+ return null;
+ }
+
+ containerIDs = getContainersForOwner(containerIDs, owner);
+ if (containerIDs.size() < numContainerPerOwnerInPipeline) {
+ synchronized (pipeline) {
+ // TODO: #CLUTIL Maybe we can add selection logic inside synchronized
+ // as well
+ containerIDs = getContainersForOwner(
+ pipelineManager.getContainersInPipeline(pipeline.getId()),
owner);
+ if (containerIDs.size() < numContainerPerOwnerInPipeline) {
+ ContainerInfo containerInfo =
+ containerStateManager.allocateContainer(pipelineManager, owner,
+ pipeline);
+ // Add to DB
+ addContainerToDB(containerInfo);
+ containerStateManager.updateLastUsedMap(pipeline.getId(),
+ containerInfo.containerID(), owner);
+ return containerInfo;
+ }
+ }
+ }
+
+ ContainerInfo containerInfo =
+ containerStateManager.getMatchingContainer(sizeRequired, owner,
+ pipeline.getId(), containerIDs);
+ if (containerInfo == null) {
+ synchronized (pipeline) {
+ containerInfo =
+ containerStateManager.allocateContainer(pipelineManager, owner,
+ pipeline);
+ // Add to DB
+ addContainerToDB(containerInfo);
+ containerStateManager.updateLastUsedMap(pipeline.getId(),
+ containerInfo.containerID(), owner);
+ }
+ } else {
+ containerStateManager.updateLastUsedMap(pipeline.getId(),
+ containerInfo.containerID(), owner);
+ }
+ // TODO: #CLUTIL cleanup entries in lastUsedMap
Review comment:
Done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 202251)
Time Spent: 40m (was: 0.5h)
> After allocating container, we are not adding to container DB.
> --------------------------------------------------------------
>
> Key: HDDS-1148
> URL: https://issues.apache.org/jira/browse/HDDS-1148
> Project: Hadoop Distributed Data Store
> Issue Type: Bug
> Components: SCM
> Reporter: Bharat Viswanadham
> Assignee: Bharat Viswanadham
> Priority: Major
> Labels: pull-request-available
> Fix For: 0.4.0
>
> Attachments: HDDS-1148.00.patch, HDDS-1148.01.patch,
> HDDS-1148.02.patch, HDDS-1148.03.patch
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> If we don't do that, we get an error when handling container report for open
> containers.
> As they don't exist in container DB.
>
> {code:java}
> scm_1 | at java.lang.Thread.run(Thread.java:748)
> scm_1 | 2019-02-21 00:00:32 ERROR ContainerReportHandler:173 -
> Received container report for an unknown container 1 from datanode
> e2733c00-162b-4993-a986-f6104f5008d8{ip: 172.18.0.2, host: 4f4e683d86c3} {}
> scm_1 |
> org.apache.hadoop.hdds.scm.container.ContainerNotFoundException: #1
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.states.ContainerStateMap.checkIfContainerExist(ContainerStateMap.java:543)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.states.ContainerStateMap.updateContainerReplica(ContainerStateMap.java:230)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.ContainerStateManager.updateContainerReplica(ContainerStateManager.java:565)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.SCMContainerManager.updateContainerReplica(SCMContainerManager.java:393)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.ReportHandlerHelper.processContainerReplica(ReportHandlerHelper.java:74)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.ContainerReportHandler.processContainerReplicas(ContainerReportHandler.java:159)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.ContainerReportHandler.onMessage(ContainerReportHandler.java:110)
> scm_1 | at
> org.apache.hadoop.hdds.scm.container.ContainerReportHandler.onMessage(ContainerReportHandler.java:51)
> scm_1 | at
> org.apache.hadoop.hdds.server.events.SingleThreadExecutor.lambda$onMessage$1(SingleThreadExecutor.java:85)
> scm_1 | at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> scm_1 | at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> {code}
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]