Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ private OzoneFileStatus getOzoneFileStatusV1(String volumeName,
refreshPipeline(fileKeyInfo);

if (sortDatanodes) {
sortDatanodeInPipeline(fileKeyInfo, clientAddress);
sortDatanodes(clientAddress, fileKeyInfo);
}
return new OzoneFileStatus(fileKeyInfo, scmBlockSize, false);
} else {
Expand Down Expand Up @@ -2430,20 +2430,19 @@ public List<OzoneFileStatus> listStatusV1(OmKeyArgs args, boolean recursive,
metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
bucketName);
}
List<OmKeyInfo> keyInfoList = new ArrayList<>(fileStatusList.size());
for (OzoneFileStatus fileStatus : fileStatusList) {
if (fileStatus.isFile()) {
// refreshPipeline flag check has been removed as part of
// https://issues.apache.org/jira/browse/HDDS-3658.
// Please refer this jira for more details.
refreshPipeline(fileStatus.getKeyInfo());

// No need to check if a key is deleted or not here, this is handled
// when adding entries to cacheKeyMap from DB.
if (args.getSortDatanodes()) {
sortDatanodeInPipeline(fileStatus.getKeyInfo(), clientAddress);
}
keyInfoList.add(fileStatus.getKeyInfo());
}
}
// refreshPipeline flag check has been removed as part of
// https://issues.apache.org/jira/browse/HDDS-3658.
// Please refer this jira for more details.
refreshPipeline(keyInfoList);
if (args.getSortDatanodes()) {
sortDatanodes(clientAddress, keyInfoList.toArray(new OmKeyInfo[0]));
}
fileStatusFinalList.addAll(fileStatusList);
return fileStatusFinalList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,

omVolumeArgs = getVolumeInfo(omMetadataManager, volumeName);
omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
// check volume quota
// check bucket and volume quota
long preAllocatedSpace = newLocationList.size()
* ozoneManager.getScmBlockSize()
* omFileInfo.getFactor().getNumber();
checkVolumeQuotaInBytes(omVolumeArgs, preAllocatedSpace);
checkBucketQuotaInBytes(omBucketInfo, preAllocatedSpace);

// Add to cache entry can be done outside of lock for this openKey.
// Even if bucket gets deleted, when commitKey we shall identify if
Expand All @@ -203,9 +203,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
Optional.absent(), Optional.of(missingParentInfos),
trxnLogIndex);

// update usedBytes atomically.
omVolumeArgs.getUsedBytes().add(preAllocatedSpace);
omBucketInfo.getUsedBytes().add(preAllocatedSpace);
omBucketInfo.incrUsedBytes(preAllocatedSpace);

// Prepare response. Sets user given full key name in the 'keyName'
// attribute in response object.
Expand All @@ -216,7 +214,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
.setCmdType(Type.CreateFile);
omClientResponse = new OMFileCreateResponseV1(omResponse.build(),
omFileInfo, missingParentInfos, clientID, omVolumeArgs,
omBucketInfo);
omBucketInfo.copyObject());

result = Result.SUCCESS;
} catch (IOException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
// be subtracted.
long correctedSpace = omKeyInfo.getDataSize() * factor -
locationInfoList.size() * scmBlockSize * factor;
omVolumeArgs.getUsedBytes().add(correctedSpace);
omBucketInfo.getUsedBytes().add(correctedSpace);
omBucketInfo.incrUsedBytes(correctedSpace);

omClientResponse = new OMKeyCommitResponseV1(omResponse.build(),
omKeyInfo, dbFileKey, dbOpenFileKey, omVolumeArgs, omBucketInfo);
omKeyInfo, dbFileKey, dbOpenFileKey, omVolumeArgs,
omBucketInfo.copyObject());

result = Result.SUCCESS;
} catch (IOException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);

long quotaReleased = sumBlockLengths(omKeyInfo);
// update usedBytes atomically.
omVolumeArgs.getUsedBytes().add(-quotaReleased);
omBucketInfo.getUsedBytes().add(-quotaReleased);
omBucketInfo.incrUsedBytes(-quotaReleased);

// No need to add cache entries to delete table. As delete table will
// be used by DeleteKeyService only, not used for any client response
Expand All @@ -161,7 +159,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
omClientResponse = new OMKeyDeleteResponseV1(omResponse
.setDeleteKeyResponse(DeleteKeyResponse.newBuilder()).build(),
omKeyInfo, ozoneManager.isRatisEnabled(), omVolumeArgs,
omBucketInfo, keyStatus.isDirectory());
omBucketInfo.copyObject(), keyStatus.isDirectory());

result = Result.SUCCESS;
} catch (IOException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
OMFileRequest.addToFileTable(omMetadataManager, batchOperation,
getOmKeyInfo());

// update volume usedBytes.
omMetadataManager.getVolumeTable().putWithBatch(batchOperation,
omMetadataManager.getVolumeKey(getOmVolumeArgs().getVolume()),
getOmVolumeArgs());
// update bucket usedBytes.
omMetadataManager.getBucketTable().putWithBatch(batchOperation,
omMetadataManager.getBucketKey(getOmVolumeArgs().getVolume(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ public void addToDBBatch(OMMetadataManager omMetadataManager,
ozoneDbKey, getOmKeyInfo());
}

// update volume usedBytes.
omMetadataManager.getVolumeTable().putWithBatch(batchOperation,
omMetadataManager.getVolumeKey(getOmVolumeArgs().getVolume()),
getOmVolumeArgs());
// update bucket usedBytes.
omMetadataManager.getBucketTable().putWithBatch(batchOperation,
omMetadataManager.getBucketKey(getOmVolumeArgs().getVolume(),
Expand Down