bharatviswa504 commented on a change in pull request #1088: HDDS-1689.
Implement S3 Create Bucket request to use Cache and DoubleBuffer.
URL: https://github.com/apache/hadoop/pull/1088#discussion_r304554453
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/volume/OMVolumeCreateRequest.java
##########
@@ -145,28 +136,24 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
try {
acquiredUserLock = omMetadataManager.getLock().acquireLock(USER_LOCK,
owner);
+ String dbVolumeKey = omMetadataManager.getVolumeKey(volume);
+
OmVolumeArgs dbVolumeArgs =
omMetadataManager.getVolumeTable().get(dbVolumeKey);
- // Validation: Check if volume already exists
- if (dbVolumeArgs != null) {
+ if (dbVolumeArgs == null) {
+ String dbUserKey = omMetadataManager.getUserKey(owner);
+ volumeList = addVolumeToOwnerList(volumeList, volume, owner,
+ ozoneManager.getMaxUserVolumeCount());
+ createVolume(omMetadataManager, omVolumeArgs, volumeList, dbVolumeKey,
+ dbUserKey, transactionLogIndex);
+ LOG.debug("volume:{} successfully created", omVolumeArgs.getVolume());
+ } else {
LOG.debug("volume:{} already exists", omVolumeArgs.getVolume());
throw new OMException("Volume already exists",
OMException.ResultCodes.VOLUME_ALREADY_EXISTS);
}
- volumeList = omMetadataManager.getUserTable().get(dbUserKey);
Review comment:
Thanks for catching. It is a coding mistake. I have fixed it, and also added
a test case for it.
----------------------------------------------------------------
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]