This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new b8e1e8f  HDDS-5999. Freon datanode chunk validator does not find 
pipeline from param (#2879)
b8e1e8f is described below

commit b8e1e8ffe009b2cf61bc1438f3cf2c5c3f64fedd
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Dec 2 10:57:29 2021 +0100

    HDDS-5999. Freon datanode chunk validator does not find pipeline from param 
(#2879)
---
 .../apache/hadoop/ozone/freon/DatanodeChunkValidator.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
index 21d23a6..5d86bc5 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
@@ -17,8 +17,8 @@
 package org.apache.hadoop.ozone.freon;
 
 import java.io.IOException;
-import java.util.List;
 import java.util.concurrent.Callable;
+import java.util.stream.Stream;
 
 import org.apache.hadoop.hdds.cli.HddsVersionProvider;
 import org.apache.hadoop.hdds.client.ReplicationConfig;
@@ -79,6 +79,7 @@ public class DatanodeChunkValidator extends BaseFreonGenerator
 
 
   @Override
+  @SuppressWarnings("java:S3864") // Stream.peek (for debug)
   public Void call() throws Exception {
 
     init();
@@ -92,18 +93,22 @@ public class DatanodeChunkValidator extends 
BaseFreonGenerator
 
     try (StorageContainerLocationProtocol scmLocationClient =
                  createStorageContainerLocationClient(ozoneConf)) {
-      List<Pipeline> pipelines = scmLocationClient.listPipelines();
+      Stream<Pipeline> pipelines = scmLocationClient.listPipelines().stream();
+      if (LOG.isDebugEnabled()) {
+        pipelines = pipelines
+            .peek(p -> LOG.debug("Found pipeline {}", p.getId()));
+      }
       Pipeline pipeline;
       if (pipelineId != null && pipelineId.length() > 0) {
-        pipeline = pipelines.stream()
-              .filter(p -> p.getId().toString().equals(pipelineId))
+        pipeline = pipelines
+              .filter(p -> p.getId().getId().toString().equals(pipelineId))
               .findFirst()
               .orElseThrow(() -> new IllegalArgumentException(
                       "Pipeline ID is defined, but there is no such pipeline: "
                               + pipelineId));
 
       } else {
-        pipeline = pipelines.stream()
+        pipeline = pipelines
             .filter(
                 p -> 
ReplicationConfig.getLegacyFactor(p.getReplicationConfig())
                     == HddsProtos.ReplicationFactor.THREE)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to