steveloughran commented on code in PR #4458: URL: https://github.com/apache/hadoop/pull/4458#discussion_r925717550
########## hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/statistics/StreamStatisticNames.java: ########## @@ -393,6 +393,12 @@ public final class StreamStatisticNames { public static final String STREAM_READ_PREFETCH_OPERATIONS = "stream_read_prefetch_operations"; + /** + * Total number of failed prefetching operations. + */ + public static final String STREAM_READ_FAILED_PREFETCH_OPERATIONS Review Comment: not needed. every duration type you build for a store automatically gets .failures stats entries (count, min, mean, max), use StoreStatisticNames.SUFFIX_FAILURES if you want to see usages ########## hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/read/S3Reader.java: ########## @@ -95,26 +102,24 @@ public void close() { private int readOneBlockWithRetries(ByteBuffer buffer, long offset, int size) throws IOException { - this.s3File.getStatistics().readOperationStarted(offset, size); + this.streamStatistics.readOperationStarted(offset, size); Invoker invoker = this.s3File.getReadInvoker(); - int invokerResponse = invoker.retry( - "read", this.s3File.getPath(), true, - () -> { + int invokerResponse = invoker.retry("read", this.s3File.getPath(), true, + trackDurationOfOperation(streamStatistics, STREAM_READ_REMOTE_BLOCK_READ, () -> { Review Comment: FYI, this will do the right thing about updating the stream statistics with the pass/fail stats differentiated ########## hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/common/TestBufferPool.java: ########## @@ -37,28 +38,33 @@ public class TestBufferPool extends AbstractHadoopTestBase { @Test public void testArgChecks() throws Exception { // Should not throw. - BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE); + BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE, + EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS); // Verify it throws correctly. ExceptionAsserts.assertThrows( IllegalArgumentException.class, "'size' must be a positive integer", - () -> new BufferPool(0, 10)); + () -> new BufferPool(0, 10, EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS)); Review Comment: use newInputStreamStatistics() which is part of S3AStatisticsContext. ########## hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/common/EmptyPrefetchingStatistics.java: ########## @@ -0,0 +1,59 @@ + /* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hadoop.fs.common; + +import java.time.Duration; + +public final class EmptyPrefetchingStatistics implements PrefetchingStatistics { Review Comment: add a static final instance of the class; make constructor private. no need to create > 1 ########## hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/common/PrefetchingStatistics.java: ########## @@ -0,0 +1,41 @@ + /* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.hadoop.fs.common; + +import java.time.Duration; + +import org.apache.hadoop.fs.statistics.IOStatisticsSource; + +public interface PrefetchingStatistics extends IOStatisticsSource { Review Comment: needs javadocs i'm afraid ########## hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/common/CachingBlockManager.java: ########## @@ -318,6 +328,7 @@ private void readBlock(BufferData data, boolean isPrefetch, BufferData.State... } if (isPrefetch) { + prefetchingStatistics.prefetchOperationStarted(); Review Comment: have this return a DurationTracker whose close() will update the statistic. on an an exception, call its failed() method to update the .failure keys intead -- 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-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org