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 "jsedding (via GitHub)" <gi...@apache.org> on 2025/10/13 10:18:43 UTC
[PR] OAK-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
jsedding opened a new pull request, #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574
(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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "nfsantos (via GitHub)" <gi...@apache.org>.
nfsantos commented on code in PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#discussion_r2428004625
##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -91,16 +94,21 @@ public List<String> listArchives() throws IOException {
.filter(blobName -> blobName.endsWith(".tar"))
.collect(Collectors.toList());
- Iterator<String> it = archiveNames.iterator();
- while (it.hasNext()) {
- String archiveName = it.next();
- if (deleteInProgress(archiveName)) {
- if (writeAccessController.isWritingAllowed()) {
- delete(archiveName);
- }
- it.remove();
- }
- }
+ Set<String> archivesToDelete = ForkJoinUtils.invokeInCustomPool(
+ "AzureArchiveManager-deleted-archive-handler",
+ Math.min(64, Math.max(1, archiveNames.size())),
+ () -> archiveNames.stream()
+ .parallel()
+ .filter(this::deleteInProgress)
+ .peek(archiveName -> {
+ if (writeAccessController.isWritingAllowed()) {
+ delete(archiveName);
+ }
+ })
+ .collect(Collectors.toUnmodifiableSet()));
+
+ archiveNames.removeAll(archivesToDelete);
Review Comment:
What about something like the snippet below? It avoids calling peek, which I feel is not intended for this type of situations. And it also checks only once if writing is allowed. The code is likely not syntactically valid, I did not check it on a IDE.
```suggestion
() -> archiveNames.stream()
.parallel() // Maybe not needed if deleteInProgress is fast?
.filter(this::deleteInProgress)
.collect(Collectors.toUnmodifiableSet()));
if (writeAccessController.isWritingAllowed()) {
archiveNames.stream().parallel().forEach(archiveName -> delete(archiveName));
}
archiveNames.removeAll(archivesToDelete);
```
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "nfsantos (via GitHub)" <gi...@apache.org>.
nfsantos commented on code in PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#discussion_r2428195791
##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -91,16 +94,21 @@ public List<String> listArchives() throws IOException {
.filter(blobName -> blobName.endsWith(".tar"))
.collect(Collectors.toList());
- Iterator<String> it = archiveNames.iterator();
- while (it.hasNext()) {
- String archiveName = it.next();
- if (deleteInProgress(archiveName)) {
- if (writeAccessController.isWritingAllowed()) {
- delete(archiveName);
- }
- it.remove();
- }
- }
+ Set<String> archivesToDelete = ForkJoinUtils.invokeInCustomPool(
+ "AzureArchiveManager-deleted-archive-handler",
+ Math.min(64, Math.max(1, archiveNames.size())),
+ () -> archiveNames.stream()
+ .parallel()
+ .filter(this::deleteInProgress)
+ .peek(archiveName -> {
+ if (writeAccessController.isWritingAllowed()) {
+ delete(archiveName);
+ }
+ })
+ .collect(Collectors.toUnmodifiableSet()));
+
+ archiveNames.removeAll(archivesToDelete);
Review Comment:
Yes, looks good, cleaner.
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#discussion_r2428121164
##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -91,16 +94,21 @@ public List<String> listArchives() throws IOException {
.filter(blobName -> blobName.endsWith(".tar"))
.collect(Collectors.toList());
- Iterator<String> it = archiveNames.iterator();
- while (it.hasNext()) {
- String archiveName = it.next();
- if (deleteInProgress(archiveName)) {
- if (writeAccessController.isWritingAllowed()) {
- delete(archiveName);
- }
- it.remove();
- }
- }
+ Set<String> archivesToDelete = ForkJoinUtils.invokeInCustomPool(
+ "AzureArchiveManager-deleted-archive-handler",
+ Math.min(64, Math.max(1, archiveNames.size())),
+ () -> archiveNames.stream()
+ .parallel()
+ .filter(this::deleteInProgress)
+ .peek(archiveName -> {
+ if (writeAccessController.isWritingAllowed()) {
+ delete(archiveName);
+ }
+ })
+ .collect(Collectors.toUnmodifiableSet()));
+
+ archiveNames.removeAll(archivesToDelete);
Review Comment:
Thanks, @nfsantos. I addressed this in 424b93d. Does that work for you?
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#issuecomment-3401046202
## [](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574)
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#discussion_r2428216361
##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -91,16 +94,21 @@ public List<String> listArchives() throws IOException {
.filter(blobName -> blobName.endsWith(".tar"))
.collect(Collectors.toList());
- Iterator<String> it = archiveNames.iterator();
- while (it.hasNext()) {
- String archiveName = it.next();
- if (deleteInProgress(archiveName)) {
- if (writeAccessController.isWritingAllowed()) {
- delete(archiveName);
- }
- it.remove();
- }
- }
+ Set<String> archivesToDelete = ForkJoinUtils.invokeInCustomPool(
+ "AzureArchiveManager-deleted-archive-handler",
+ Math.min(64, Math.max(1, archiveNames.size())),
+ () -> archiveNames.stream()
+ .parallel()
+ .filter(this::deleteInProgress)
+ .peek(archiveName -> {
+ if (writeAccessController.isWritingAllowed()) {
+ delete(archiveName);
+ }
+ })
+ .collect(Collectors.toUnmodifiableSet()));
+
+ archiveNames.removeAll(archivesToDelete);
Review Comment:
Agreed, thanks!
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "nfsantos (via GitHub)" <gi...@apache.org>.
nfsantos commented on code in PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#discussion_r2428004625
##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -91,16 +94,21 @@ public List<String> listArchives() throws IOException {
.filter(blobName -> blobName.endsWith(".tar"))
.collect(Collectors.toList());
- Iterator<String> it = archiveNames.iterator();
- while (it.hasNext()) {
- String archiveName = it.next();
- if (deleteInProgress(archiveName)) {
- if (writeAccessController.isWritingAllowed()) {
- delete(archiveName);
- }
- it.remove();
- }
- }
+ Set<String> archivesToDelete = ForkJoinUtils.invokeInCustomPool(
+ "AzureArchiveManager-deleted-archive-handler",
+ Math.min(64, Math.max(1, archiveNames.size())),
+ () -> archiveNames.stream()
+ .parallel()
+ .filter(this::deleteInProgress)
+ .peek(archiveName -> {
+ if (writeAccessController.isWritingAllowed()) {
+ delete(archiveName);
+ }
+ })
+ .collect(Collectors.toUnmodifiableSet()));
+
+ archiveNames.removeAll(archivesToDelete);
Review Comment:
What about this? It avoid calling peek, which I feel is not intended for this type of situations. And it also checks only once if writing is allowed. The code is likely not syntactically valid, I did not check it on a IDE.
```suggestion
() -> archiveNames.stream()
.parallel() // Maybe not needed if deleteInProgress is fast?
.filter(this::deleteInProgress)
.collect(Collectors.toUnmodifiableSet()));
if (writeAccessController.isWritingAllowed()) {
archiveNames.stream().parallel().forEach(archiveName -> delete(archiveName));
}
archiveNames.removeAll(archivesToDelete);
```
##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -91,16 +94,21 @@ public List<String> listArchives() throws IOException {
.filter(blobName -> blobName.endsWith(".tar"))
.collect(Collectors.toList());
- Iterator<String> it = archiveNames.iterator();
- while (it.hasNext()) {
- String archiveName = it.next();
- if (deleteInProgress(archiveName)) {
- if (writeAccessController.isWritingAllowed()) {
- delete(archiveName);
- }
- it.remove();
- }
- }
+ Set<String> archivesToDelete = ForkJoinUtils.invokeInCustomPool(
+ "AzureArchiveManager-deleted-archive-handler",
+ Math.min(64, Math.max(1, archiveNames.size())),
+ () -> archiveNames.stream()
+ .parallel()
+ .filter(this::deleteInProgress)
+ .peek(archiveName -> {
+ if (writeAccessController.isWritingAllowed()) {
+ delete(archiveName);
+ }
+ })
+ .collect(Collectors.toUnmodifiableSet()));
+
+ archiveNames.removeAll(archivesToDelete);
Review Comment:
What about this? It avoids calling peek, which I feel is not intended for this type of situations. And it also checks only once if writing is allowed. The code is likely not syntactically valid, I did not check it on a IDE.
```suggestion
() -> archiveNames.stream()
.parallel() // Maybe not needed if deleteInProgress is fast?
.filter(this::deleteInProgress)
.collect(Collectors.toUnmodifiableSet()));
if (writeAccessController.isWritingAllowed()) {
archiveNames.stream().parallel().forEach(archiveName -> delete(archiveName));
}
archiveNames.removeAll(archivesToDelete);
```
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding merged PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574
--
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-11980 - improve parallelization of I/O during segment-azure initialization [jackrabbit-oak]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #2574:
URL: https://github.com/apache/jackrabbit-oak/pull/2574#issuecomment-3399168531
## [](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574) **Quality Gate passed**
Issues
 [4 New issues](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=2574)
--
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