bharatviswa504 commented on a change in pull request #949: HDDS-1672. Improve
locking in OzoneManager.
URL: https://github.com/apache/hadoop/pull/949#discussion_r295954759
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerLock.java
##########
@@ -59,32 +68,39 @@
* <br>
* {@literal ->} acquireVolumeLock (will work)<br>
* {@literal +->} acquireBucketLock (will work)<br>
- * {@literal +-->} acquireUserLock (will throw Exception)<br>
+ * {@literal +-->} acquireS3BucketLock (will throw Exception)<br>
* </p>
* <br>
- * To acquire a user lock you should not hold any Volume/Bucket lock. Similarly
- * to acquire a Volume lock you should not hold any Bucket lock.
+ * To acquire a S3 lock you should not hold any Volume/Bucket lock. Similarly
+ * to acquire a Volume lock you should not hold any Bucket/User/S3
+ * Secret/Prefix lock.
*/
public final class OzoneManagerLock {
+ private static final Logger LOG =
+ LoggerFactory.getLogger(OzoneManagerLock.class);
+
+ private static final String S3_BUCKET_LOCK = "s3BucketLock";
private static final String VOLUME_LOCK = "volumeLock";
private static final String BUCKET_LOCK = "bucketLock";
- private static final String PREFIX_LOCK = "prefixLock";
- private static final String S3_BUCKET_LOCK = "s3BucketLock";
+ private static final String USER_LOCK = "userLock";
private static final String S3_SECRET_LOCK = "s3SecretetLock";
+ private static final String PREFIX_LOCK = "prefixLock";
+
private final LockManager<String> manager;
// To maintain locks held by current thread.
private final ThreadLocal<Map<String, AtomicInteger>> myLocks =
ThreadLocal.withInitial(
- () -> ImmutableMap.of(
- VOLUME_LOCK, new AtomicInteger(0),
- BUCKET_LOCK, new AtomicInteger(0),
- PREFIX_LOCK, new AtomicInteger(0),
- S3_BUCKET_LOCK, new AtomicInteger(0),
- S3_SECRET_LOCK, new AtomicInteger(0)
- )
+ () -> ImmutableMap.<String, AtomicInteger>builder()
+ .put(S3_BUCKET_LOCK, new AtomicInteger(0))
+ .put(VOLUME_LOCK, new AtomicInteger(0))
+ .put(BUCKET_LOCK, new AtomicInteger(0))
+ .put(USER_LOCK, new AtomicInteger(0))
+ .put(S3_SECRET_LOCK, new AtomicInteger(0))
+ .put(PREFIX_LOCK, new AtomicInteger(0))
+ .build()
Review comment:
This will be taken up in a new jira.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]