You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "reschke (via GitHub)" <gi...@apache.org> on 2026/03/09 17:33:41 UTC
[PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
reschke opened a new pull request, #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792
(no comment)
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4130754760
## [](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792) **Quality Gate passed**
Issues
 [2 New issues](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [93.3% Coverage on New Code](https://sonarcloud.io/component_measures?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2792)
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4034147411
The test fails for me as well. Occasiionally.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "Joscorbe (via GitHub)" <gi...@apache.org>.
Joscorbe commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2907681840
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
*/
@Override
public Throttler throttler() {
- return delegate.throttler();
+ return leaseChecking(() ->
+ delegate.throttler());
+ }
+
+ private <T> T leaseChecking(Supplier<T> operation) {
+ performLeaseCheck();
+ try {
+ return operation.get();
+ } finally {
+ performLeaseCheck();
+ }
+ }
+ private void leaseChecking(Runnable operation) {
+ performLeaseCheck();
+ try {
+ operation.run();
+ } finally {
+ performLeaseCheck();
Review Comment:
Haven't tested this, but isn't it possible that the operation throws an exception and the lease check in **finally** also fails, so the DocumentStoreException from the lease check would mask the exception thrown by the operation?
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "Joscorbe (via GitHub)" <gi...@apache.org>.
Joscorbe commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4026509202
I wonder if we should add a distinct log message when the lease check fails after the operation has already run (in the finally block). That would make it easier to find and analyze cases where the lease was lost during the call.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2909987461
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
*/
@Override
public Throttler throttler() {
- return delegate.throttler();
+ return leaseChecking(() ->
+ delegate.throttler());
+ }
+
+ private <T> T leaseChecking(Supplier<T> operation) {
+ performLeaseCheck();
+ try {
+ return operation.get();
+ } finally {
+ performLeaseCheck();
+ }
+ }
+ private void leaseChecking(Runnable operation) {
+ performLeaseCheck();
+ try {
+ operation.run();
+ } finally {
+ performLeaseCheck();
Review Comment:
Yes, I think. Note that this case apparently has no test coverage (or it is the reason for the tests complaining about the incorrect exception message). Let me try that.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2907135186
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -242,7 +244,8 @@ public <T extends Document> void prefetch(Collection<T> collection,
*/
@Override
public int getNodeNameLimit() {
- return delegate.getNodeNameLimit();
+ return leaseChecking(() ->
Review Comment:
same as `throttler` method.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2907113348
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -52,133 +53,134 @@ public LeaseCheckDocumentStoreWrapper(final DocumentStore delegate, final Cluste
this.clusterNodeInfo = clusterNodeInfo;
}
- private final void performLeaseCheck() {
+ private void performLeaseCheck() {
if (clusterNodeInfo != null) {
clusterNodeInfo.performLeaseCheck();
}
}
@Override
- public final <T extends Document> T find(Collection<T> collection, String key) {
- performLeaseCheck();
- return delegate.find(collection, key);
+ public <T extends Document> T find(Collection<T> collection, String key) {
+ return leaseChecking(() ->
+ delegate.find(collection, key));
}
@Override
- public final <T extends Document> T find(Collection<T> collection, String key,
- int maxCacheAge) {
- performLeaseCheck();
- return delegate.find(collection, key, maxCacheAge);
+ public <T extends Document> T find(Collection<T> collection, String key,
+ int maxCacheAge) {
+ return leaseChecking(() ->
+ delegate.find(collection, key, maxCacheAge));
+
}
@Override
- public final <T extends Document> List<T> query(Collection<T> collection,
- String fromKey, String toKey, int limit) {
- performLeaseCheck();
- return delegate.query(collection, fromKey, toKey, limit);
+ public <T extends Document> List<T> query(Collection<T> collection,
+ String fromKey, String toKey, int limit) {
Review Comment:
same as above
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4074609325
Changes:
1. Late writes are now ERROR-logged (code change minimal so that we dnot have to touch `ClusterNodeInfo`.
2. Test assertion changed so that 'both' exception messages are tolerated.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2907133731
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
*/
@Override
public Throttler throttler() {
- return delegate.throttler();
+ return leaseChecking(() ->
Review Comment:
why we need to check the lease timeout here ?
cc @stefan-egli
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2909922175
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
*/
@Override
public Throttler throttler() {
- return delegate.throttler();
+ return leaseChecking(() ->
Review Comment:
we don't need to, indeed.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4029509607
also:
https://issues.apache.org/jira/browse/OAK-12128?focusedCommentId=18064369&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-18064369
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke merged PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4029370525
> I wonder if we should add a distinct log message when the lease check fails after the operation has already run (in the finally block). That would make it easier to find and analyze cases where the lease was lost during the call.
@Joscorbe - https://issues.apache.org/jira/browse/OAK-12128?focusedCommentId=18064356&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-18064356
Well, help in analyzing is the whole point of this PR. The question is whether it actually adds anything, because next a DSException will be thrown anyway.
Adding this requires minor changes in `ClusterNode` - API to check without throwing; or potentially to `performLeaseCheck()`.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2909922175
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
*/
@Override
public Throttler throttler() {
- return delegate.throttler();
+ return leaseChecking(() ->
Review Comment:
We don't need to, indeed.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2907112063
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -52,133 +53,134 @@ public LeaseCheckDocumentStoreWrapper(final DocumentStore delegate, final Cluste
this.clusterNodeInfo = clusterNodeInfo;
}
- private final void performLeaseCheck() {
+ private void performLeaseCheck() {
if (clusterNodeInfo != null) {
clusterNodeInfo.performLeaseCheck();
}
}
@Override
- public final <T extends Document> T find(Collection<T> collection, String key) {
- performLeaseCheck();
- return delegate.find(collection, key);
+ public <T extends Document> T find(Collection<T> collection, String key) {
+ return leaseChecking(() ->
+ delegate.find(collection, key));
Review Comment:
Please remove the unintended spaces.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on code in PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#discussion_r2909987461
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/LeaseCheckDocumentStoreWrapper.java:
##########
@@ -253,6 +256,24 @@ public int getNodeNameLimit() {
*/
@Override
public Throttler throttler() {
- return delegate.throttler();
+ return leaseChecking(() ->
+ delegate.throttler());
+ }
+
+ private <T> T leaseChecking(Supplier<T> operation) {
+ performLeaseCheck();
+ try {
+ return operation.get();
+ } finally {
+ performLeaseCheck();
+ }
+ }
+ private void leaseChecking(Runnable operation) {
+ performLeaseCheck();
+ try {
+ operation.run();
+ } finally {
+ performLeaseCheck();
Review Comment:
Yes, I think. Note that this case apparently has no test coverage (or it is the reason for the tests complaining about the incorrect exception message). Let me try that.
EDIT: yes, that's the reason. Good catch.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12128: Fail earlier (and add more diags) when detecting late writes [jackrabbit-oak]
Posted by "reschke (via GitHub)" <gi...@apache.org>.
reschke commented on PR #2792:
URL: https://github.com/apache/jackrabbit-oak/pull/2792#issuecomment-4029482512
Note: I could minimize the diff by re-adding the `final`s.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org