You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/07/14 15:25:18 UTC
[GitHub] [hadoop] ZanderXu opened a new pull request, #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
ZanderXu opened a new pull request, #4565:
URL: https://github.com/apache/hadoop/pull/4565
### Description of PR
Improve Code With Lambda in AsyncLoggerSet class
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] slfan1989 commented on pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
slfan1989 commented on PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#issuecomment-1195639105
some checkStyle need fix
```
./hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:208: public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(long epoch) {:32: ',' is not followed by whitespace. [WhitespaceAfter]
./hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:253: QuorumCall<AsyncLogger,Void> acceptRecovery(SegmentStateProto log, URL fromURL) {:25: ',' is not followed by whitespace. [WhitespaceAfter]
```
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] ZanderXu commented on pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
ZanderXu commented on PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#issuecomment-1195280747
@goiri Can help me push this pr forward? After this, I will create a PR try to improve codes with Lambda in the whole hadoop-hdfs module.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] goiri commented on a diff in pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
goiri commented on code in PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#discussion_r921689045
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:
##########
@@ -206,197 +194,114 @@ List<AsyncLogger> getLoggersForTests() {
///////////////////////////////////////////////////////////////////////////
public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() {
- Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.getJournalState());
- }
+ Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournalState()));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Boolean> isFormatted() {
Map<AsyncLogger, ListenableFuture<Boolean>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.isFormatted());
- }
+ loggers.forEach(l -> calls.put(l, l.isFormatted()));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(
- NamespaceInfo nsInfo,
- long epoch) {
- Map<AsyncLogger, ListenableFuture<NewEpochResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.newEpoch(epoch));
- }
+ public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(long epoch) {
+ Map<AsyncLogger, ListenableFuture<NewEpochResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.newEpoch(epoch)));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger, Void> startLogSegment(
- long txid, int layoutVersion) {
+ public QuorumCall<AsyncLogger, Void> startLogSegment(long txid, int layoutVersion) {
Map<AsyncLogger, ListenableFuture<Void>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.startLogSegment(txid, layoutVersion));
- }
+ loggers.forEach(l -> calls.put(l, l.startLogSegment(txid, layoutVersion)));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger, Void> finalizeLogSegment(long firstTxId,
- long lastTxId) {
+ public QuorumCall<AsyncLogger, Void> finalizeLogSegment(long firstTxId, long lastTxId) {
Map<AsyncLogger, ListenableFuture<Void>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.finalizeLogSegment(firstTxId, lastTxId));
- }
+ loggers.forEach(l -> calls.put(l, l.finalizeLogSegment(firstTxId, lastTxId)));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Void> sendEdits(
long segmentTxId, long firstTxnId, int numTxns, byte[] data) {
Map<AsyncLogger, ListenableFuture<Void>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<Void> future =
- logger.sendEdits(segmentTxId, firstTxnId, numTxns, data);
- calls.put(logger, future);
- }
+ loggers.forEach(l -> calls.put(l, l.sendEdits(segmentTxId, firstTxnId, numTxns, data)));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, GetJournaledEditsResponseProto>
getJournaledEdits(long fromTxnId, int maxTransactions) {
- Map<AsyncLogger,
- ListenableFuture<GetJournaledEditsResponseProto>> calls
- = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<GetJournaledEditsResponseProto> future =
- logger.getJournaledEdits(fromTxnId, maxTransactions);
- calls.put(logger, future);
- }
+ Map<AsyncLogger, ListenableFuture<GetJournaledEditsResponseProto>> calls = Maps.newHashMap();
Review Comment:
As we are at it, can we get rid of the guava use?
We should also set it with the capacity being `loggers.size()`
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] ZanderXu commented on a diff in pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
ZanderXu commented on code in PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#discussion_r922941580
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:
##########
@@ -206,197 +194,114 @@ List<AsyncLogger> getLoggersForTests() {
///////////////////////////////////////////////////////////////////////////
public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() {
- Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.getJournalState());
- }
+ Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournalState()));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Boolean> isFormatted() {
Map<AsyncLogger, ListenableFuture<Boolean>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.isFormatted());
- }
+ loggers.forEach(l -> calls.put(l, l.isFormatted()));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(
- NamespaceInfo nsInfo,
Review Comment:
Thanks @goiri for your review.
`nsInfo` is never used. HDFS-12553 started using `nsInfo` in `IPCLoggerChannel.class` as follows:
```
@Override
public ListenableFuture<NewEpochResponseProto> newEpoch(
final long epoch) {
return singleThreadExecutor.submit(new Callable<NewEpochResponseProto>() {
@Override
public NewEpochResponseProto call() throws IOException {
return getProxy().newEpoch(journalId, nameServiceId, nsInfo, epoch);
}
});
}
```
So we can get rid of the useless `nsInfo` here.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] hadoop-yetus commented on pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
hadoop-yetus commented on PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#issuecomment-1184902970
:broken_heart: **-1 overall**
| Vote | Subsystem | Runtime | Logfile | Comment |
|:----:|----------:|--------:|:--------:|:-------:|
| +0 :ok: | reexec | 0m 40s | | Docker mode activated. |
|||| _ Prechecks _ |
| +1 :green_heart: | dupname | 0m 0s | | No case conflicting files found. |
| +0 :ok: | codespell | 0m 0s | | codespell was not available. |
| +0 :ok: | detsecrets | 0m 0s | | detect-secrets was not available. |
| +1 :green_heart: | @author | 0m 0s | | The patch does not contain any @author tags. |
| -1 :x: | test4tests | 0m 0s | | The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. |
|||| _ trunk Compile Tests _ |
| +1 :green_heart: | mvninstall | 37m 32s | | trunk passed |
| +1 :green_heart: | compile | 1m 43s | | trunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 |
| +1 :green_heart: | compile | 1m 37s | | trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
| +1 :green_heart: | checkstyle | 1m 27s | | trunk passed |
| +1 :green_heart: | mvnsite | 1m 44s | | trunk passed |
| +1 :green_heart: | javadoc | 1m 26s | | trunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 |
| +1 :green_heart: | javadoc | 1m 47s | | trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
| +1 :green_heart: | spotbugs | 3m 47s | | trunk passed |
| +1 :green_heart: | shadedclient | 23m 13s | | branch has no errors when building and testing our client artifacts. |
|||| _ Patch Compile Tests _ |
| +1 :green_heart: | mvninstall | 1m 24s | | the patch passed |
| +1 :green_heart: | compile | 1m 25s | | the patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 |
| +1 :green_heart: | javac | 1m 25s | | the patch passed |
| +1 :green_heart: | compile | 1m 23s | | the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
| +1 :green_heart: | javac | 1m 23s | | the patch passed |
| +1 :green_heart: | blanks | 0m 0s | | The patch has no blanks issues. |
| -0 :warning: | checkstyle | 1m 3s | [/results-checkstyle-hadoop-hdfs-project_hadoop-hdfs.txt](https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4565/1/artifact/out/results-checkstyle-hadoop-hdfs-project_hadoop-hdfs.txt) | hadoop-hdfs-project/hadoop-hdfs: The patch generated 2 new + 9 unchanged - 6 fixed = 11 total (was 15) |
| +1 :green_heart: | mvnsite | 1m 29s | | the patch passed |
| +1 :green_heart: | javadoc | 0m 59s | | the patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 |
| +1 :green_heart: | javadoc | 1m 34s | | the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
| +1 :green_heart: | spotbugs | 3m 19s | | the patch passed |
| +1 :green_heart: | shadedclient | 22m 23s | | patch has no errors when building and testing our client artifacts. |
|||| _ Other Tests _ |
| +1 :green_heart: | unit | 239m 9s | | hadoop-hdfs in the patch passed. |
| +1 :green_heart: | asflicense | 1m 15s | | The patch does not generate ASF License warnings. |
| | | 348m 44s | | |
| Subsystem | Report/Notes |
|----------:|:-------------|
| Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4565/1/artifact/out/Dockerfile |
| GITHUB PR | https://github.com/apache/hadoop/pull/4565 |
| Optional Tests | dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
| uname | Linux 138bf5b13f6c 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev-support/bin/hadoop.sh |
| git revision | trunk / 8f38839e6159bf7034ffae7e7ef1d2b424baa73f |
| Default Java | Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
| Multi-JDK versions | /usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07 |
| Test Results | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4565/1/testReport/ |
| Max. process+thread count | 3207 (vs. ulimit of 5500) |
| modules | C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs |
| Console output | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4565/1/console |
| versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
| Powered by | Apache Yetus 0.14.0 https://yetus.apache.org |
This message was automatically generated.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class [hadoop]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
URL: https://github.com/apache/hadoop/pull/4565
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] goiri commented on a diff in pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
goiri commented on code in PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#discussion_r921545467
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:
##########
@@ -206,197 +194,114 @@ List<AsyncLogger> getLoggersForTests() {
///////////////////////////////////////////////////////////////////////////
public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() {
- Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.getJournalState());
- }
+ Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournalState()));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Boolean> isFormatted() {
Map<AsyncLogger, ListenableFuture<Boolean>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.isFormatted());
- }
+ loggers.forEach(l -> calls.put(l, l.isFormatted()));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(
- NamespaceInfo nsInfo,
Review Comment:
Why don't we use this anymore?
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] ZanderXu commented on pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
ZanderXu commented on PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#issuecomment-1197526280
@goiri Hi, master, can you help me merge it into the trunk? I will move to improve codes with Lambda in the whole hadoop-hdfs module.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] ZanderXu commented on pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
ZanderXu commented on PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#issuecomment-1195661469
Thanks @slfan1989 . Please review the latest patch, I have fixed these check style.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
[GitHub] [hadoop] goiri commented on a diff in pull request #4565: HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class
Posted by GitBox <gi...@apache.org>.
goiri commented on code in PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#discussion_r921687765
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:
##########
@@ -206,197 +194,114 @@ List<AsyncLogger> getLoggersForTests() {
///////////////////////////////////////////////////////////////////////////
public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() {
- Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.getJournalState());
- }
+ Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournalState()));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Boolean> isFormatted() {
Map<AsyncLogger, ListenableFuture<Boolean>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.isFormatted());
- }
+ loggers.forEach(l -> calls.put(l, l.isFormatted()));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(
- NamespaceInfo nsInfo,
- long epoch) {
- Map<AsyncLogger, ListenableFuture<NewEpochResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.newEpoch(epoch));
- }
+ public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(long epoch) {
+ Map<AsyncLogger, ListenableFuture<NewEpochResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.newEpoch(epoch)));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger, Void> startLogSegment(
- long txid, int layoutVersion) {
+ public QuorumCall<AsyncLogger, Void> startLogSegment(long txid, int layoutVersion) {
Map<AsyncLogger, ListenableFuture<Void>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.startLogSegment(txid, layoutVersion));
- }
+ loggers.forEach(l -> calls.put(l, l.startLogSegment(txid, layoutVersion)));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger, Void> finalizeLogSegment(long firstTxId,
- long lastTxId) {
+ public QuorumCall<AsyncLogger, Void> finalizeLogSegment(long firstTxId, long lastTxId) {
Map<AsyncLogger, ListenableFuture<Void>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.finalizeLogSegment(firstTxId, lastTxId));
- }
+ loggers.forEach(l -> calls.put(l, l.finalizeLogSegment(firstTxId, lastTxId)));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Void> sendEdits(
long segmentTxId, long firstTxnId, int numTxns, byte[] data) {
Map<AsyncLogger, ListenableFuture<Void>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<Void> future =
- logger.sendEdits(segmentTxId, firstTxnId, numTxns, data);
- calls.put(logger, future);
- }
+ loggers.forEach(l -> calls.put(l, l.sendEdits(segmentTxId, firstTxnId, numTxns, data)));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, GetJournaledEditsResponseProto>
getJournaledEdits(long fromTxnId, int maxTransactions) {
- Map<AsyncLogger,
- ListenableFuture<GetJournaledEditsResponseProto>> calls
- = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<GetJournaledEditsResponseProto> future =
- logger.getJournaledEdits(fromTxnId, maxTransactions);
- calls.put(logger, future);
- }
+ Map<AsyncLogger, ListenableFuture<GetJournaledEditsResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournaledEdits(fromTxnId, maxTransactions)));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, RemoteEditLogManifest> getEditLogManifest(
long fromTxnId, boolean inProgressOk) {
- Map<AsyncLogger,
- ListenableFuture<RemoteEditLogManifest>> calls
- = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<RemoteEditLogManifest> future =
- logger.getEditLogManifest(fromTxnId, inProgressOk);
- calls.put(logger, future);
- }
+ Map<AsyncLogger, ListenableFuture<RemoteEditLogManifest>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getEditLogManifest(fromTxnId, inProgressOk)));
return QuorumCall.create(calls);
}
- QuorumCall<AsyncLogger, PrepareRecoveryResponseProto>
- prepareRecovery(long segmentTxId) {
- Map<AsyncLogger,
- ListenableFuture<PrepareRecoveryResponseProto>> calls
- = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<PrepareRecoveryResponseProto> future =
- logger.prepareRecovery(segmentTxId);
- calls.put(logger, future);
- }
+ QuorumCall<AsyncLogger, PrepareRecoveryResponseProto> prepareRecovery(long segmentTxId) {
+ Map<AsyncLogger, ListenableFuture<PrepareRecoveryResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.prepareRecovery(segmentTxId)));
return QuorumCall.create(calls);
}
- QuorumCall<AsyncLogger,Void>
- acceptRecovery(SegmentStateProto log, URL fromURL) {
- Map<AsyncLogger, ListenableFuture<Void>> calls
- = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- ListenableFuture<Void> future =
- logger.acceptRecovery(log, fromURL);
- calls.put(logger, future);
- }
+ QuorumCall<AsyncLogger,Void> acceptRecovery(SegmentStateProto log, URL fromURL) {
Review Comment:
QuorumCall<AsyncLogger,Void> acceptRecovery(SegmentStateProto log, URL fromURL) {:25: ',' is not followed by whitespace. [WhitespaceAfter]
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java:
##########
@@ -206,197 +194,114 @@ List<AsyncLogger> getLoggersForTests() {
///////////////////////////////////////////////////////////////////////////
public QuorumCall<AsyncLogger, GetJournalStateResponseProto> getJournalState() {
- Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.getJournalState());
- }
+ Map<AsyncLogger, ListenableFuture<GetJournalStateResponseProto>> calls = Maps.newHashMap();
+ loggers.forEach(l -> calls.put(l, l.getJournalState()));
return QuorumCall.create(calls);
}
public QuorumCall<AsyncLogger, Boolean> isFormatted() {
Map<AsyncLogger, ListenableFuture<Boolean>> calls = Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.isFormatted());
- }
+ loggers.forEach(l -> calls.put(l, l.isFormatted()));
return QuorumCall.create(calls);
}
- public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(
- NamespaceInfo nsInfo,
- long epoch) {
- Map<AsyncLogger, ListenableFuture<NewEpochResponseProto>> calls =
- Maps.newHashMap();
- for (AsyncLogger logger : loggers) {
- calls.put(logger, logger.newEpoch(epoch));
- }
+ public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(long epoch) {
Review Comment:
public QuorumCall<AsyncLogger,NewEpochResponseProto> newEpoch(long epoch) {:32: ',' is not followed by whitespace. [WhitespaceAfter]
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org
Re: [PR] HDFS-16661. Improve Code With Lambda in AsyncLoggerSet class [hadoop]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4565:
URL: https://github.com/apache/hadoop/pull/4565#issuecomment-3507233610
We're closing this stale PR because it has been open for 100 days with no activity. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you feel like this was a mistake, or you would like to continue working on it, please feel free to re-open it and ask for a committer to remove the stale tag and review again.
Thanks all for your contribution.
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org