Skip to content

Conversation

@cxorm
Copy link
Member

@cxorm cxorm commented Nov 14, 2019

What changes were proposed in this pull request?

We would update the modificationTime of volume when

  • volume create
  • volume update (set owner/quota)

And we would update the modificationTime of bucket when

  • bucket create

So we focus on these items.

Proposed fix.

This PR aims to add filed of modificationTime to volume and bucket.

For volume part, besides adding field in volume, we have 3 requests to be fixed that are
OMVolumeCreateRequest, OMVolumeSetOwnerRequest and OMVolumeSetQuotaRequest.

Because modificationTime should be consistent among OM,
we refer Handling Write Requests with OM HA to fix these requests. (By setting modificationTime in preExecute(), and using it for late validation.)

  • note
    After setting Owner/Quota of volume, the original UpdateVolumeHandler would print old modificationTime cause its volume is not updated volume(just updated owner/quota).
    We should get volume again for getting newer modification.

For bucket part, we should fix OMBucketCreateRequest.
And for consistent,
we set modificationTime of creating bucket in OMBucketCreateRequest#preExecute().

What is the link to the Apache JIRA

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

How was this patch tested?

Copy link
Contributor

@dineshchitlangia dineshchitlangia left a comment

Choose a reason for hiding this comment

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

@cxorm Thank you for working on this. Overall LGTM, however, some of the tests don't validate modification time.
Ideally for some of the test like SetQuota, SetOwner etc, you would want to validate that after the operation the modificationTime is > creationTime.
This approach will confirm the modification time is being set appropriately.

@cxorm
Copy link
Member Author

cxorm commented Nov 18, 2019

@cxorm Thank you for working on this. Overall LGTM, however, some of the tests don't validate modification time.
Ideally for some of the test like SetQuota, SetOwner etc, you would want to validate that after the operation the modificationTime is > creationTime.
This approach will confirm the modification time is being set appropriately.

Thanks @dineshchitlangia for the comment.
I fixed the UTs to test modificationTime with updating quota/owner.

@cxorm
Copy link
Member Author

cxorm commented Nov 18, 2019

/retest

@cxorm
Copy link
Member Author

cxorm commented Nov 18, 2019

The UT's error seems not related to the PR.

Copy link
Contributor

@dineshchitlangia dineshchitlangia left a comment

Choose a reason for hiding this comment

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

+1 LGTM. @anuengineer / @arp7 request your review as well.

@cxorm
Copy link
Member Author

cxorm commented Nov 21, 2019

+1 LGTM. @anuengineer / @arp7 request your review as well.

Thanks @dineshchitlangia for the review.

@cxorm
Copy link
Member Author

cxorm commented Nov 25, 2019

Hi @anuengineer ,
Would you help to review the PR, thanks

@cxorm
Copy link
Member Author

cxorm commented Dec 5, 2019

This patch is not complete now.
I think we would fix it after resolving HDDS-2629.

@anuengineer
Copy link
Contributor

ok, I will wait for a rebase. Thanks

@cxorm cxorm force-pushed the HDDS-426 branch 2 times, most recently from ed2803a to c609f35 Compare December 7, 2019 06:54
@dineshchitlangia
Copy link
Contributor

+1 LGTM.
@anuengineer Could you pls review this when you get a chance and then we can merge it soon? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Should we use Time.now() which is a wrapper of System.currentTimeMillis consistently across the patch? This will make it easier to maintain the code in the long run. Otherwise, LGTM.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @xiaoyuyao for the review.
Replace it with setModificationTime(), and update the corresponding call.

Copy link
Contributor

@bharatviswa504 bharatviswa504 Dec 16, 2019

Choose a reason for hiding this comment

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

Modification time should be set in the preExecute, and use the same value in validateAndUpdateCache. why it needs to be done like this is, in HA all OM's should have the same modification time, in this case there is a chance of OM's having different modification time because it depends on the time when validateAndUpdateCache will be executed on OM.

Copy link
Member Author

@cxorm cxorm Dec 17, 2019

Choose a reason for hiding this comment

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

Thanks @bharatviswa504 for the info.
This info is important for me.
Updated with setting preExecute.

Copy link
Contributor

@bharatviswa504 bharatviswa504 Dec 16, 2019

Choose a reason for hiding this comment

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

Modification time should be set in the preExecute, and use the same value in validateAndUpdateCache. why it needs to be done like this is, in HA all OM's should have the same modification time, in this case there is a chance of OM's having different modification time because it depends on the time when validateAndUpdateCache will be executed on OM.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @bharatviswa504 for the review.
Updated with setting preExecute.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here do we need to get the value once, and set the same value for creatiionTime and ModificationTime. Because once after createBucket, there is a chance of these having different values.

long updateTime = Time.now(), and then use this in setting mofication and creation time.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @bharatviswa504 for the comment.
Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here do we need to get the value once, and set the same value for creatiionTime and ModificationTime. Because once after createBucket, there is a chance of these having different values.

long updateTime = Time.now(), and then use this in setting mofication and creation time.

Same as below.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a comment

Choose a reason for hiding this comment

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

One generic comment modification time should be set in PreExecute and use that in ValidateAndUpdateCache. (Similar to create requests)

@cxorm cxorm requested a review from bharatviswa504 December 18, 2019 06:05
@cxorm
Copy link
Member Author

cxorm commented Jan 19, 2020

This PR would be redone and fixed soon.

@cxorm
Copy link
Member Author

cxorm commented Jan 30, 2020

Some tests would be updated soon.

@cxorm
Copy link
Member Author

cxorm commented Jan 30, 2020

Description of this PR was updated and execution snapshots were uploaded in JIRA.

@bharatviswa504 , @anuengineer Could you help review this PR if you have a time ?

@elek
Copy link
Member

elek commented Feb 10, 2020

ping @bharatviswa504 @anuengineer

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we consider the backward compatibility here when changing the public client APIs? This will be important moving forward from Beta to GA.

Copy link
Member Author

@cxorm cxorm Apr 10, 2020

Choose a reason for hiding this comment

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

Thanks @xiaoyuyao for the idea.

The backward compatibility is updated.

Copy link
Contributor

@xiaoyuyao xiaoyuyao left a comment

Choose a reason for hiding this comment

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

Thanks @cxorm for the patch. LGTM overall, a few comments added inline. Also, there are other volume/bucket metadata/ACL update APIs that will need similar modification time update. This could be done in a separate JIRA giving the size of the current one. Also, we need to document this modification time only apply to volume/bucket metadata modification itself, not covering key changes under the volume bucket.

@cxorm
Copy link
Member Author

cxorm commented May 26, 2020

Thank you @xiaoyuyao for reviewing this PR.

I think the current violation is not related the change,/.
could you please take a look ? (and if you think it is not proper, we can trigger CI again.)

@cxorm
Copy link
Member Author

cxorm commented Jun 8, 2020

Hi @xiaoyuyao,
Could you help take a look on this PR again, the CI passed all checks.

Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified using Instant without conversions.

this.modifiedTime = Instant.now();
if (modifiedTime.isBefore(this.creationTime)) {
this.modificationTime = this.creationTime.clone();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

similar 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.

similar as above to avoid Time.now()

Copy link
Contributor

Choose a reason for hiding this comment

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

similar as above to avoid Time.now()

Copy link
Contributor

Choose a reason for hiding this comment

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

similar as above to avoid Time.now()

Copy link
Contributor

@xiaoyuyao xiaoyuyao left a comment

Choose a reason for hiding this comment

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

LGTM, just few additional minor comments and I think we are ready for the commit. Thanks for the patience for this one.

@codecov-commenter
Copy link

Codecov Report

Merging #164 into master will decrease coverage by 0.17%.
The diff coverage is 71.71%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #164      +/-   ##
============================================
- Coverage     70.56%   70.38%   -0.18%     
+ Complexity     9427     9419       -8     
============================================
  Files           965      967       +2     
  Lines         49063    49352     +289     
  Branches       4803     4831      +28     
============================================
+ Hits          34620    34737     +117     
- Misses        12137    12277     +140     
- Partials       2306     2338      +32     
Impacted Files Coverage Δ Complexity Δ
...main/java/org/apache/hadoop/ozone/OzoneConsts.java 84.21% <ø> (ø) 1.00 <0.00> (ø)
...hadoop/ozone/shell/volume/UpdateVolumeHandler.java 8.33% <0.00%> (-0.76%) 1.00 <0.00> (ø)
...va/org/apache/hadoop/ozone/client/OzoneBucket.java 77.16% <36.84%> (-6.80%) 35.00 <2.00> (+3.00) ⬇️
...va/org/apache/hadoop/ozone/client/OzoneVolume.java 75.29% <50.00%> (-12.01%) 17.00 <4.00> (+2.00) ⬇️
...g/apache/hadoop/ozone/om/helpers/OmVolumeArgs.java 90.43% <81.81%> (-1.00%) 23.00 <3.00> (+2.00) ⬇️
.../org/apache/hadoop/ozone/client/rpc/RpcClient.java 81.35% <100.00%> (+0.58%) 66.00 <0.00> (+2.00)
...g/apache/hadoop/ozone/om/helpers/OmBucketInfo.java 82.43% <100.00%> (+1.13%) 23.00 <1.00> (+1.00)
...ozone/om/request/bucket/OMBucketCreateRequest.java 82.30% <100.00%> (+0.31%) 12.00 <0.00> (ø)
...ozone/om/request/volume/OMVolumeCreateRequest.java 97.64% <100.00%> (+0.11%) 9.00 <0.00> (ø)
...one/om/request/volume/OMVolumeSetOwnerRequest.java 98.98% <100.00%> (+0.11%) 11.00 <1.00> (+1.00)
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8fcc47...d18db72. Read the comment docs.

@cxorm
Copy link
Member Author

cxorm commented Jun 24, 2020

Thank you @xiaoyuyao for the detailed review.
Comments fixed.

@cxorm cxorm requested a review from xiaoyuyao June 24, 2020 11:18
@xiaoyuyao
Copy link
Contributor

LGTM, +1. Thanks @cxorm for the patience. I will merge the PR shortly.

@xiaoyuyao xiaoyuyao merged commit 9779b0c into apache:master Jun 26, 2020
@cxorm
Copy link
Member Author

cxorm commented Jun 27, 2020

Thank you @xiaoyuyao for taking time to review this PR again and again : )
I would create jira for the issue during disscussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants