Skip to content

Conversation

@captainzmc
Copy link
Member

@captainzmc captainzmc commented Sep 17, 2020

What changes were proposed in this pull request?

In addition, the current Quota setting does not take effect. HDDS-541 gives all the work needed to perfect Quota.
This PR is a subtask of HDDS-541.

Volume has implemented increase usedBytes when write, and this PR is based on #1296.
In this PR we judge whether the Volume can be written when we write the key if the volume space quota enable.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-3727

How was this patch tested?

UT added.

@captainzmc
Copy link
Member Author

hi @ChenSammi @xiaoyuyao, this PR add judge whether we can be write if space quota enable. Can you help to review this?

Copy link
Contributor

@ChenSammi ChenSammi Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUOTA_CHECK_ERROR -> QUOTA_EXCEEDED

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add used bytes check in each test case?

long preAllocatedSpace = newLocationList.size()
* ozoneManager.getScmBlockSize()
* omKeyInfo.getFactor().getNumber();
if (omVolumeArgs.getQuotaInBytes() > OzoneConsts.QUOTA_RESET) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a isQuotaInBytesSet check in OmVolumeArgs and use this function instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to put the if in checkVolumeQuotaInBytes, which might seem a little more compact.

// volume Args will be persisted to the DB.
// TODO: There is a delay in updating DB in this way, and if necessary
// we can modify the ErrorOMResponse to avoid it.
omVolumeArgs.getUsedBytes().add(-keyAllocatedSpace);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If A object has multiple blocks, and quota_exceeded exception is thrown out at the last block, shall we only deduct the block space size at this step?

// AllocateBlock failed, volume usedBytes should be 0
Assert.assertEquals(0L, store.getVolume(volumeName).getUsedBytes());

Assert.assertEquals(3, countException);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a multiple block write case here,so the first few block will succeed, while the later block will fail due to quota exceed?

+ allocateSize) + " Bytes.",
OMException.ResultCodes.QUOTA_EXCEEDED);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnessary empty line.


return omClientResponse;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnessary blank line.

@captainzmc
Copy link
Member Author

Thanks @ChenSammi for the review. Review issues has been fixed.

@ChenSammi
Copy link
Contributor

LGTM +1.

@ChenSammi ChenSammi merged commit 525ecbb into apache:master Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants