[ 
https://issues.apache.org/jira/browse/HDFS-16429?focusedWorklogId=713487&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-713487
 ]

ASF GitHub Bot logged work on HDFS-16429:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Jan/22 04:37
            Start Date: 24/Jan/22 04:37
    Worklog Time Spent: 10m 
      Work Description: MingXiangLi commented on a change in pull request #3900:
URL: https://github.com/apache/hadoop/pull/3900#discussion_r790408740



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/AutoCloseDataSetLock.java
##########
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdfs.server.common;
+
+import org.apache.hadoop.util.AutoCloseableLock;
+import org.apache.hadoop.util.StringUtils;
+
+import java.util.concurrent.locks.Lock;
+
+import static org.apache.hadoop.hdfs.server.datanode.DataSetLockManager.LOG;
+
+/**
+ * Extending AutoCloseableLock such that the users can
+ * use a try-with-resource syntax.
+ */
+public class AutoCloseDataSetLock extends AutoCloseableLock {
+  private Lock lock;
+  private AutoCloseDataSetLock parentLock;
+  private DataNodeLockManager<AutoCloseDataSetLock> dataNodeLockManager;
+
+  public AutoCloseDataSetLock(Lock lock) {

Review comment:
       not all AutoCloseDataSetLock should have parent lock and lockManager.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 713487)
    Time Spent: 1h 20m  (was: 1h 10m)

> Add DataSetLockManager to maintain locks for FsDataSetImpl
> ----------------------------------------------------------
>
>                 Key: HDFS-16429
>                 URL: https://issues.apache.org/jira/browse/HDFS-16429
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs
>    Affects Versions: 3.2.0
>            Reporter: Mingxiang Li
>            Assignee: Mingxiang Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.2.0
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> 1、Use lockManager to maintain two level lock for FsDataSetImpl.
> The simple lock model like this.Parts of implemented as follows
>  * As for finalizeReplica(),append(),createRbw()....First get BlockPoolLock 
> read lock,and then get BlockPoolLock-volume-lock write lock.
>  * As for getStoredBlock(),getMetaDataInputStream()....First get 
> BlockPoolLock read lock,and the then get BlockPoolLock-volume-lock read lock.
>  * As for deepCopyReplica(),getBlockReports() get the BlockPoolLock read lock.
>  * As for delete hold the BlockPoolLock write lock.
> 2、Make LightWeightResizableGSet become thread safe.It not become performance 
> bottleneck if we make it thread safe.We can reduce lock grain size for 
> ReplicaMap when make LightWeightResizableGSet thread safe.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to