You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/07/12 00:13:31 UTC
[GitHub] [ozone] ghuangups opened a new pull request, #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
ghuangups opened a new pull request, #3588:
URL: https://github.com/apache/ozone/pull/3588
…ty args check to after tryWriteLockThrowOnTimeout().
## What changes were proposed in this pull request?
Move the sanity arguments check to after tryWriteLockThrowOnTimeout(). The original implementation will throw IllegalArgumentException when another tenant write request is in-progress.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-6990)
## How was this patch tested?
N/A
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] kerneltime commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
kerneltime commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919232309
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
It would make sense to check inside a try and release the lock on failure. Also, `validateAndUpdateCache` has a pre-condition check which might also land up not unlocking on exception, might make sense to clean up that code as well.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] ghuangups commented on pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
ghuangups commented on PR #3588:
URL: https://github.com/apache/ozone/pull/3588#issuecomment-1183484467
We'll address validateAndUpdateCache code via HDDS-7001.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
smengcl commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919307698
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
> It would make sense to check inside a try and release the lock on failure.
I'm not sure I understand this sentence. If an exception is thrown (e.g. `InterruptedException`), the lock won't be acquired in the first place.
> Also, `validateAndUpdateCache` has a pre-condition check which might also land up not unlocking on exception, might make sense to clean up that code as well.
Good catch! `Preconditions.checkXYZ`s in `OMTenantCreateRequest#validateAndUpdateCache` should be moved inside the `try` block. Also we need to double check if other tenant requests have `Preconditions.checkXYZ` outside of `try` block in `validateAndUpdateCache` as well.
We could piggy-back that fix in this PR.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
smengcl commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919554586
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
> In the case of a bug causing the Precondition to fail
I agree that if the `Precondition` in `tryWriteLockInOMRequest` failed, the lock won't be released. Actually the OM will be in serious trouble if the `Precondition` check doesn't pass (e.g. when some one / some other thread is using the lock incorrectly).
Honestly I think we should just intentionally crash the OM at this point because OM is likely running in an undefined / unrecoverable state at this point, and the sooner it crashes the easier to debug the problem (and prevent the unknown error from propagating).
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] kerneltime merged pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
kerneltime merged PR #3588:
URL: https://github.com/apache/ozone/pull/3588
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] kerneltime commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
kerneltime commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919556183
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
@smengcl this is a bug around tenant administration, not sure if crashing OM would be the right way. That said, I agree that if precondition were to fail, it would imply a serious coding issue here... At a minimum we need to clean up the precondition check in `validateAndUpdateCache` and insure that the lock is unlocked.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
smengcl commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919554586
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
> In the case of a bug causing the Precondition to fail
I agree that if the `Precondition` in `tryWriteLockInOMRequest` failed, the lock won't be released. Actually the OM will be in serious trouble if the `Precondition` check doesn't pass (e.g. when some one / some other thread is using the lock incorrectly).
Honestly I think we should just intentionally crash the OM because OM is likely running in an undefined / unrecoverable state at this point, and the sooner it crashes the easier to debug the problem (and prevent the unknown error from propagating).
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
smengcl commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919554586
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
> In the case of a bug causing the Precondition to fail
I agree that if the `Precondition` in `tryWriteLockInOMRequest` failed, the lock won't be released. Actually the OM will be in serious trouble if the `Precondition` check doesn't pass (e.g. when some one / some other thread is using the lock incorrectly). Honestly I think should just intentionally crash the OM at this point because OM is likely running in an undefined / unrecoverable state at this point, and the sooner it crashes the easier to debug the problem (and prevent the unknown error from propagating).
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] kerneltime commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
kerneltime commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919437292
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
In the case of a bug causing the `Precondition` to fail, we are still holding with the lock when an `IllegalArgumentException` is thrown due to the check having failed. It is a minor nit and unlikely to occur but from a completeness stand point, we should release the lock.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
[GitHub] [ozone] smengcl commented on a diff in pull request #3588: HDDS-6990. AuthorizerLockImpl.java#tryWriteLockInOMRequest: move sani…
Posted by GitBox <gi...@apache.org>.
smengcl commented on code in PR #3588:
URL: https://github.com/apache/ozone/pull/3588#discussion_r919554586
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/multitenant/AuthorizerLockImpl.java:
##########
@@ -132,11 +132,12 @@ public long tryWriteLockThrowOnTimeout() throws IOException {
@Override
public void tryWriteLockInOMRequest() throws IOException {
+ long stamp = tryWriteLockThrowOnTimeout();
+
// Sanity check. Must not have held a write lock in a tenant OMRequest.
Preconditions.checkArgument(omRequestWriteLockStamp == 0L);
Review Comment:
> In the case of a bug causing the Precondition to fail
I agree that if the `Precondition` in `tryWriteLockInOMRequest` failed, the lock won't be released. Actually the OM will be in serious trouble if the `Precondition` check doesn't pass (e.g. when some one / some other thread is using the lock incorrectly), and some damage might have already been done (like race condition -> corruption -> inconsistent OM state)
Honestly I think we should just intentionally crash the OM because OM is likely running in an undefined / unrecoverable state at this point, and the sooner it crashes the easier to debug the problem (and prevent the unknown error from propagating).
--
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.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org